Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Merging csv data to produce query

Status
Not open for further replies.

Freefall27

Technical User
Sep 8, 2005
65
0
0
US
I have seperate CSV files (one for each loaction) that are generated from a system. I need to take the CSV output from each and combine into one query and sum the rseults.

I am using Access 2003 and have the CSV files imported at this time. I have 11 total spreadsheets which have about 60 fields each.

Example

Spreadsheet #1 ABC Town
Fields
A Usage B Usage C Usage
1,096,000 200,000 159,000

Spreadsheet #2 XYZ Town
Fields
A Usage B Usage C Usage
904,000 100,000 41,000

I would like to merge the spreadsheets together in a query and produce an overall total for each field.

MS Query

A Usage B Usage C Usage
2,000,000 300,000 200,000

Then calculate the % each represents in comparison to the total.

If more information is required please let me know.
 
Select sum(a usage)suma,sum(b usage)sumb,sum(C usage)sumc
from(
Select *
from Spread1
union
Select *
from Spread2
....
union
Select *
from Spread11
)dt
the above will give you the sum of all spreads
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top