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 |
arun_kumar112
Starting Member
2 Posts |
Posted - 2010-05-19 : 00:56:05
|
Hi All,Can i use group by statement in switch case.Please suggest,when i am writing thisselect placement_date, balance = CASE balance WHEN balance BETWEEN 100 and 200 THEN 'Less than 200'WHEN balance BETWEEN 200 and 300 THEN 'Less than 300'ELSE 'Greater Than 300'END,COUNT(*)from todialer group by placement_dateit gives error Msg 156, Level 15, State 1, Line 3Incorrect syntax near the keyword 'BETWEEN'.need help.Thanks in advance,ArunArun Kuma |
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-05-19 : 01:43:09
|
2 things:1.CASE balance WHEN ... THENorCASE WHEN balance ... THEN2.In your statement balance isn't grouped so you can't use it without an aggregate function like min(),max() or so.. No, you're never too old to Yak'n'Roll if you're too young to die. |
|
|
|
|
|