SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 if statement question
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

masterdineen
Aged Yak Warrior

United Kingdom
548 Posts

Posted - 02/08/2013 :  10:52:16  Show Profile  Reply with Quote
hello there.

i want to create a multi if statement with and conditions.

see my query below.



select client_ref, if [2013] > 0 and [2012] = 0 and [2011] = 0 then 'New'

from Match_Count_By_Year

im wondering if i could use a case, but not sure how to with multi and's conditions.

webfred
Flowing Fount of Yak Knowledge

Germany
8765 Posts

Posted - 02/08/2013 :  10:56:25  Show Profile  Visit webfred's Homepage  Reply with Quote

select 
client_ref, 
CASE 
  WHEN [2013] > 0 and [2012] = 0 and [2011] = 0 then 'New'
  ELSE 'notNew'
END as ColumnName
from...



Too old to Rock'n'Roll too young to die.
Go to Top of Page

masterdineen
Aged Yak Warrior

United Kingdom
548 Posts

Posted - 02/08/2013 :  10:58:37  Show Profile  Reply with Quote
ive just sussed it out, ive done exactly what you done.

thank you very much.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.03 seconds. Powered By: Snitz Forums 2000