Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Adding amount for each customer

Author  Topic 

snufse
Constraint Violating Yak Guru

469 Posts

Posted - 2007-03-22 : 15:22:31
I am fairly new to sql. Reading a table I need to show amount for each customer. Also I need to add amount for each customer that has more than one entry. What would the sql statement look like? Thank you.

Records in file:
Company Amount
Customer1 24.000
Customer2 36.000
Customer3 72.000
Customer1 20.000
Customer3 15.000

Desired results:
Company Amount
Customer1 44.000
Customer2 36.000
Customer3 87.000


snSQL
Master Smack Fu Yak Hacker

1837 Posts

Posted - 2007-03-22 : 16:08:06
Take a look at the GROUP BY clause and the use of aggergate functions in Books Online.
Go to Top of Page
   

- Advertisement -