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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 CASE STATEMENT for checking range values

Author  Topic 

sqlnovice123
Constraint Violating Yak Guru

262 Posts

Posted - 2010-03-16 : 12:30:18
Hi

I am using the below but it gives a syntax error. What am I doing wrong? Where rsc is the alias for a temp table that contains col DealerCnt. Thanks

CASE
WHEN rsc.DealerCnt >1 & <= 5 THEN '<=5 Dealers'
WHEN rsc.DealerCnt > 5 & <= 10 THEN '<=10 Dealers'
WHEN rsc.DealerCnt > 10 THEN '>10 Dealers'
END

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-03-16 : 12:33:23
CASE
WHEN rsc.DealerCnt >1 AND rsc.DealerCnt<= 5 THEN '<=5 Dealers'
WHEN rsc.DealerCnt > 5 AND rsc.DealerCnt<= 10 THEN '<=10 Dealers'
WHEN rsc.DealerCnt > 10 THEN '>10 Dealers'
END

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -