MySQL SUM包括所有项目,应具体说明

时间:2019-05-02 02:22:36

标签: mysql

我当前拥有的脚本是:

SELECT MONTH(invoice_date) AS Month,equipment_name AS "Equipmet_Name", Sum(equipment_qty) AS Amount 
FROM invoices JOIN line_items,equipment
GROUP BY Month,equipment_name

我得到的是:

Month, Equipmet_Name, Amount
1   Gas grill   4290
1   3 x 5 folding table 4290
1   Folding chair   4290
1   5 x 9 folding table 4290
1   20 X 14 Tents   4290
1   Gazebo  4290
1   Trampoline  4290
1   Cotton candy machine    4290

总金额未按每个项目分开。它似乎正在将所有项目加在一起。我需要添加/更改以使其根据每月的商品分开吗?

0 个答案:

没有答案