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 |
|
sunsanvin
Master Smack Fu Yak Hacker
1274 Posts |
Posted - 2007-04-16 : 08:01:19
|
| Dear Experts,I've one result set, as shown below.I need only two rows actually.for all Bank CA-25, the UOM should be added and should display in one row.same as for Bank CA-50 code also. please guide me.Code Name UOM Bank CA-25 No of Leaves 10.000 Bank CA-25 No of Leaves 100.000 Bank CA-25 No of Leaves 100.000 Bank CA-25 No of Leaves 5000.000 Bank CA-50 No of Leaves 1110.000 Bank CA-50 No of Leaves 9000.000 Bank CA-50 No of Leaves 8000.000Thank you very muchVinod |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-04-16 : 08:03:18
|
| Hint: Use GROUP BY with SUM().Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
sunsanvin
Master Smack Fu Yak Hacker
1274 Posts |
Posted - 2007-04-16 : 08:08:25
|
| table name is table_leaves. can you please tell me the queryVinod |
 |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-04-16 : 08:16:32
|
Even after 100 posts, you don't know how to use GROUP BY? Try to understand the solutions posted here.SELECT CODE, NAME, SUM(UOM) AS UOMFROM table_leavesGROUP BY CODE, NAME Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
sunsanvin
Master Smack Fu Yak Hacker
1274 Posts |
Posted - 2007-04-16 : 08:22:13
|
| Actually in work hurry I was unable to think.actually the query is so big with joins.thank you harshaVinod |
 |
|
|
|
|
|