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.
Author |
Topic |
anupalavila
Yak Posting Veteran
56 Posts |
Posted - 2009-01-20 : 04:27:00
|
Hai I have a table in which fields are Id,price,quantity,AmountIf I have values like this in my tableId price quantity Amount1 25 5 1251 25 5 100 2 20 4 802 20 1 201 25 10 250how can I make a query to result Id price quantity Amount1 25 20 4752 20 5 100ie sum of the quantity and Amount rows with same Id Regards,Anu PalavilaThanks and Regards Anu Palavila |
|
bklr
Master Smack Fu Yak Hacker
1693 Posts |
Posted - 2009-01-20 : 04:43:20
|
select id,price sum(quantity) as quantity, sum(amount)as amount from urtable group by id, price |
|
|
anupalavila
Yak Posting Veteran
56 Posts |
Posted - 2009-01-20 : 07:03:12
|
Thakns bklr for your valuable replayThanks and Regards Anu Palavila |
|
|
ra.shinde
Posting Yak Master
103 Posts |
Posted - 2009-01-20 : 07:05:34
|
1 25 5 100 It has to be 1 25 5 125Rahul Shinde |
|
|
bklr
Master Smack Fu Yak Hacker
1693 Posts |
Posted - 2009-01-20 : 07:52:05
|
quote: Originally posted by anupalavila Thakns bklr for your valuable replayThanks and Regards Anu Palavila
ur welcome |
|
|
|
|
|