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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sum a column produced by a query. 1

Status
Not open for further replies.

lizarde03

MIS
Feb 9, 2004
22
US
I can't figure out how to do this. I have a query that produces the following results:

A 1 234
A 2 34621
A 3 2356
A 4 4571
B 1 23556
B 2 2345
B 3 3466
B 4 2356
C 1 3467

I need a sum of all A's (234+34621+2356+4571) a sum of all B's (23556+2345+3466+2356) and all c's (3467) Any suggestions?
 
If I understand correctly, try:
SELECT UnNamedField1, Sum(UnNamedField3) as SumUF3
FROM TableNamed
GROUP BY UnNamedField1;

Duane
MS Access MVP
[green]Ask a great question, get a great answer.[/green]
[red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
[blue]Ask me about my grandson, get a grand answer.[/blue]
 
it'd be easier to do this in a report, where you can just group the data on Col1 and then show the sum of col3 per group...


--------------------
Procrastinate Now!
 
Simply create a total query based on your actual query.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
I tried the first approach and I can't get my punctuation correct. I need this in query form so a report won't work. I don't know how to do a total query. Any other suggestions. I don't know sql so i have to use the GUI version of access. Thanks!
 
Just create a new query and select "View->Totals". Add your first and third fields to the grid. Set the "total" line to Group By for the first and Sum for the other.

Duane
MS Access MVP
[green]Ask a great question, get a great answer.[/green]
[red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
[blue]Ask me about my grandson, get a grand answer.[/blue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top