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
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Want to write a case within select comparing other
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Aged Yak Warrior

567 Posts

Posted - 12/07/2012 :  13:58:03  Show Profile  Reply with Quote
Want to write a case within select comparing other column within the select statement:

Is this the right way both fields are numeric fields:

WHEN P_P_R.PRSNL_PERSON_ID = prsnl_al.alias then 1

Thanks a lot for the helpful info.

Flowing Fount of Yak Knowledge

5155 Posts

Posted - 12/07/2012 :  14:05:01  Show Profile  Reply with Quote
Assuming you want to return 1 when column PRSNL_PERSON_ID in table (or table alias) P_P_R has the same value as column "alias" in table (or table alias) prsnl_al it is correct. If the two columns are not equal, or if one or both of them are null, you will get 2.
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.02 seconds. Powered By: Snitz Forums 2000