Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

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

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

Aged Yak Warrior

United Kingdom
550 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.

Flowing Fount of Yak Knowledge

8781 Posts

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

  WHEN [2013] > 0 and [2012] = 0 and [2011] = 0 then 'New'
  ELSE 'notNew'
END as ColumnName

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

Aged Yak Warrior

United Kingdom
550 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  
 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