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

SQL SELECT QUESTION

Status
Not open for further replies.

TSO456

Technical User
Jul 23, 2001
57
US
Hello,

I would appreciate your help in writting a SQL that would select from the client ID (Client ID is not unique) and sum the amount column for that client. For Example the resulting query for client ID (A) would be $600 (500+100). The resulting query for client ID (B) would be $20.

The resulting query should display the client ID and the total $ amount for that client.

Client ID Purchase $Amount

A Apples $500
A Oranges $100
B Apples $20
C Oranges $80
D Apples $60

Thank you
 
select [Client ID], sum($Amount) from YourTablesNameHere grou by [Client ID] Ion Filipski
1c.bmp


filipski@excite.com
 
Hi, TSO456

This question seems virtually identical to the one you posted earlier in thread220-124719. Could you give us some detail as to whether the proposed "group by" solution worked? If not, what went wrong? Is the current query really the same, or is there some subtle difference that I'm not seeing?
 
I found that the client ID is not unique.

Thanks
 
Ah, I see. However I think you will find that "group by" will still work. Have you given it a try?
 
It worked. I really appreciate your help.

Have a nice weekend!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top