Thursday, January 26, 2012

SQL Case Syntax

Here is simple way to using case in your T-SQL

select

CASE
when count(accounts) < 1 then 'Incomplete'
when count(accounts) = 1 then 'One Login'
when count(accounts) = 2 then 'Two Login'
when count(accounts) = 3 then 'Three Login'
when count(accounts) > 3 then 'Complete'

END LoginInfo
from tblemplogin

0 comments:

Post a Comment