MS Query SQL

jpenn

Board Regular
Joined
Jul 15, 2004
Messages
79
I'm working in MS Query and created a query from a table called MONTHLY that sums amounts grouped by account numbers. I use the MS Query window to create the query which generates this SQL statement:

SELECT MONTHLY.ACCOUNT, SUM(MONTHLY.AMOUNT)
FROM TDWT01.MONTHLY MONTHLY
GROUP BY MONTHLY.ACCOUNT

This returns to Excel the data I want to see (although the column heading in Excel for the sum(Amount) columns says "2"). However, when I go back into MS Query to edit the query - the SQL says:

SELECT MONTHLY.ACCOUNT, MONTHLY.AMOUNT
FROM TDWT01.MONTHLY MONTHLY

I lose the SUM and the GROUP BY. It doesn't matter if I create the query using the MS Query window or if I type the SQL code into the SQL window - I still lose the SUM and GROUP BY when I go back into MS Query to edit the query in any way.

It's puzzling - any ideas?
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.

Forum statistics

Threads
1,202,987
Messages
6,052,938
Members
444,616
Latest member
novit19089

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