Group a column in a query

benjamint

Board Regular
Joined
Jun 24, 2009
Messages
114
Dear All,

I have the following question:

I've built a query with Microsoft Query, but unfortunately I get for example the following date when I run the Query:

Product Amount
A 5
B 6
A 2
A 1
C 1
D 3
D 3
C 4

I'd like to get the following date when I run the query (i'd like to get totals):


Product Amount
A 8
B 6
C 5
D 6

In Acces this is easy to do, by using the option SUM, but how do you do it in in MS Query? When I use the SUM icon in MS Query it's giving me an error message: Function SUM cannot be used with ..............

I will also paste below my SQL:

SELECT "TEST COMPANY$G_L Entry"."G_L Account No_", "TEST COMPANY$G_L Entry"."Posting Date", "TEST COMPANY$G_L Entry".Amount, "TEST COMPANY$G_L Entry"."Global Dimension 1 Code", "TEST COMPANY$G_L Entry"."Global Dimension 2 Code", "TEST COMPANY$G_L Entry"."Debit Amount", "TEST COMPANY$G_L Entry"."Credit Amount", "TEST COMPANY$G_L Account".Income_Balance<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>
FROM NAV5Scheuten.dbo."TEST COMPANY$G_L Account" "TEST COMPANY$G_L Account", NAV5Scheuten.dbo."TEST COMPANY$G_L Entry" "TEST COMPANY$G_L Entry"<o:p></o:p>
WHERE "TEST COMPANY$G_L Entry"."G_L Account No_" = "TEST COMPANY$G_L Account".No_ AND (("TEST COMPANY$G_L Account".Income_Balance=?) AND ("TEST COMPANY$G_L Entry"."Posting Date">=? And "TEST COMPANY$G_L Entry"."Posting Date"<=?) AND ("TEST COMPANY$G_L Entry"."G_L Account No_"='26601'))<o:p></o:p>
ORDER BY "TEST COMPANY$G_L Entry"."G_L Account No_"<o:p></o:p>



Thanks in advance for your help!!!
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.

Forum statistics

Threads
1,224,564
Messages
6,179,543
Members
452,924
Latest member
JackiG

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top