如何将我的结果总计为一条记录而不是item_id的多个实例。相反,我需要为每件商品开具总数量的发票。如何总计SQL结果
查询结果 http://i.imgur.com/uakv7e5.jpg
select
inv_mast.default_product_group,
inv_mast.item_id,
inv_mast.item_desc,oe_hdr.order_date,
oe_line.qty_invoiced,
oe_line.extended_price
from
job_price_hdr
join oe_hdr on oe_hdr.job_price_hdr_uid = job_price_hdr.job_price_hdr_uid
join oe_line on oe_line.order_no = oe_hdr.order_no
join inv_mast on inv_mast.inv_mast_uid = oe_line.inv_mast_uid
where
oe_line.qty_invoiced> 0
and
oe_hdr.customer_id = 100080
and
default_product_group = 'FAST'
order by
inv_mast.item_id
SQL有一个sum()函数。你知道如何使用它吗? – 2014-11-06 17:08:07
只是学习它。 – eggwhites 2014-11-06 17:12:25