Click here to Skip to main content
15,902,299 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am having a table like this
Date          Company Name        Amount
2013-12-11    smevc               500
2013-12-21    smevc               500
2013-12-21    smevc               1000
2013-12-21    smevc               6726
2013-12-21    smevc               8354.40
2013-12-20    smevc               700
2013-12-22    sec                 3736
I need the output as
COMPNAME    AMT
 Smevc      17780.4
 sec        3536

What can i do to get the output?
Posted
Updated 28-Dec-13 0:52am
v2

1 solution

Try this:
SQL
SELECT [Company Name] AS COMPNAME, SUM(Amount) AS AMT
FROM TableName
GROUP BY [Company Name]
 
Share this answer
 
v2
Comments
Peter Leow 28-Dec-13 6:58am    
Cannot beat you. Struggling on my mobile. +5.
Maciej Los 28-Dec-13 7:01am    
Thank you, Peter ;)
sivamzcet 28-Dec-13 7:01am    
yes u ryt.. and also i need another one query. Can u reply me?
Maciej Los 28-Dec-13 7:04am    
With pleasure ;)
Post new question and wait for answer ;)
sivamzcet 28-Dec-13 7:14am    
i posted one question. I hope u give correct ans :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900