Combine Duplicate and Total

Meking

New member
Local time
Today, 13:36
Joined
Aug 10, 2007
Messages
8
I need a report to print out from a form that combines like Items and then totals them. The report will not have the department field listed....

Here's an example:

Form:

Department---Product#---Type----Qty-Cost-- Total

Accounting---------i123 ----pen---- 2-- 1.00-- 2.00
Management--------a987 ----paper-- 3 --1.00-- 3.00
HouseKeeping-------i123 ----pen ----1 --1.00 --1.00
Shiping/Receiving---a987---- paper-- 4 --1.00 --4.00


What I need :
Product#---Type----Qty-Cost-- Total
i123-------- pen ----3 --1.00 --3.00
a987------- paper --7 --1.00 --7.00


Please help......
 
a simple GROUP BY query with grouping on product and total, and aggregate sum fields for qty, cost and total would solve this.

Code:
SELECT [Product#],Type,SUM(fldQty) as Qty,SUM(fldCost) as Cost,SUM(fldTotal) as Total
FROM YourTable 
GROUP BY [Product#],Type
 

Users who are viewing this thread

Back
Top Bottom