Odbc ms query

beancounter

Board Regular
Joined
Oct 30, 2002
Messages
111
I am using ODBC to customer db. each customer has two services (water & sewer) the db breaks out the services onto two lines with an amount owed for each service. I need to create a flat file with the total amount owed.

Does anyone know how to group the customers and aggregate the amounts into one in ODBC before the exporting to Excel?

For instance - Current view:
Account # Current Balance Utility Type
1234 55.00 S
1234 45.00 W
5678 20.00 S
5678 20.00 W

Need:
Account # Current Balance Utility Type
1234 100.00
5678 40.00

Thanks ~ John
 
Last edited:

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Just in case you're still looking for an answer...

This can be done within MS Query by clicking the SQL icon and then modifying the SQL statments as follows:
1. Add a GROUP BY statement at the bottom (but above the ORDER BY statement, if any). Then add the field names that you want the summary to be based on (ie: Account# only if you want the summary at account level)
2. In the SELECT statement, delete the "tablename.Utility Type" field because you won't be bringing this into excel and modify the "tablename.Account #" field to "Sum(tablename.Account #)" except don't use the quote marks.

If you have problems setting this up, please post your SQL and I'll try to modify it for you.
 
Upvote 0

Forum statistics

Threads
1,223,909
Messages
6,175,310
Members
452,634
Latest member
cpostell

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