是否可以连接两个表,过滤数据并在 MS 访问中采用聚合功能?我有两张桌子
Inv_details:invnum,itmcde,qnt,price
Inv_summary:invnum,date,total
我需要加入这些表并使用日期范围过滤它们,并通过 itmcde 获得 qnt 和价格订单的总和。
我尝试过这样的事情。
SELECT inv.itmcde,SUM(inv.qnt),SUM(inv.price) FROM (SELECT inv_s.invnum,inv_s.date,inv_d.itmcde,inv_d.total FROM Inv_summary as inv_s INNER JOIN Invoice_details as inv_d ON inv_d.invnum =inv_s.invNum WHERE inv_s.date BETWEEN #3/4/2013# And #5/16/2013# ) as inv ORDER BY inv.itmcde
但这不起作用。