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 |
|
Sarakumar
Posting Yak Master
108 Posts |
Posted - 2006-05-14 : 23:02:22
|
| Hai, i have a requirment,i have table userid calloutno callinno usertype 1 10 10 Admin2 10 15 user if usertype = 'Admin' i need to findout the count callount and callin as 'TotalPhoneCalls' output userid TotalPhonecalls1 20 (10+10)2 15(only the callinno)1.Can i do this without using the Table variable or in other words, how can i achieve this in the Simplest and easy way |
|
|
derrickleggett
Pointy Haired Yak DBA
4184 Posts |
Posted - 2006-05-14 : 23:12:43
|
| select userid, case when usertype = 'Admin' then calloutno + callinno else callinno end TotalPhonecallsfrom tableMeanOldDBAderrickleggett@hotmail.comWhen life gives you a lemon, fire the DBA. |
 |
|
|
Sarakumar
Posting Yak Master
108 Posts |
Posted - 2006-05-14 : 23:36:16
|
HAI,quote: Originally posted by derrickleggett select userid, case when usertype = 'Admin' then calloutno + callinno else callinno end TotalPhonecallsfrom tableMeanOldDBAderrickleggett@hotmail.comWhen life gives you a lemon, fire the DBA.
|
 |
|
|
Sarakumar
Posting Yak Master
108 Posts |
Posted - 2006-05-14 : 23:36:44
|
HAI, tHANKS,Got the idea to solve my problem.quote: Originally posted by derrickleggett select userid, case when usertype = 'Admin' then calloutno + callinno else callinno end TotalPhonecallsfrom tableMeanOldDBAderrickleggett@hotmail.comWhen life gives you a lemon, fire the DBA.
|
 |
|
|
|
|
|