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 |
|
daisy
Starting Member
13 Posts |
Posted - 2005-04-11 : 10:08:13
|
| From one table I need to combine totals from a few differentid's:select member_id = case when member_id = 257 then 222 when member_id = 255 then 247 when member_id = 256 then 247 else member_id end, sum(final)From PP_Countswhere job_id = 923 group by member_id, finallooks like this:member_id final1. 190 73042. 222 99143. 230 49584. 245 132525. 247 125806. 249 80837. 252 69768. 247 9689. 247 33310.222 2484my question is how to call id's with final total's to look like this?member_id final1. 190 73042. 222 123983. 230 49584. 245 132525. 247 138816. 249 80837. 252 6976Everything I've tried doesn't work? |
|
|
mr_mist
Grunnio
1870 Posts |
Posted - 2005-04-11 : 10:27:55
|
select member_id = case when member_id = 257then 222when member_id = 255then 247when member_id = 256then 247else member_idend,sum(final)From PP_Countswhere job_id = 923 group by member_id -------Moo. :) |
 |
|
|
daisy
Starting Member
13 Posts |
Posted - 2005-04-11 : 10:45:47
|
| Thanks for replying so fast but that isn't working.When I run that, it just lists all the member_id's withfinal totals it doesn't combine totals together were thesame id is listed. |
 |
|
|
mr_mist
Grunnio
1870 Posts |
Posted - 2005-04-11 : 10:56:15
|
select member_id = case when member_id = 257then 222when member_id = 255then 247when member_id = 256then 247else member_idend,sum(final)From PP_Countswhere job_id = 923 group by case when member_id = 257then 222when member_id = 255then 247when member_id = 256then 247else member_idend -------Moo. :) |
 |
|
|
daisy
Starting Member
13 Posts |
Posted - 2005-04-11 : 11:08:19
|
| Thanks Moo you stud! |
 |
|
|
|
|
|