By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,346 Members | 2,331 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,346 IT Pros & Developers. It's quick & easy.

Sql Case Statement

P: 7
I'm new to SQL, and I'm hoping to get some help in selecting a value based on a hierachy.

What I'm trying to achieve is get the campus phone number, and if this is not available, then go down the hierarchy:
if campus phone is null then get business_phone
if business_phone is null then get permanent_phone

columns in the table are defined as follows:
emp_id, tele_code, tele_phone
1234 CA (campus) NULL
1234 PR(permanent) xxx-xxxx
1234 BU(business) xxx-xxxx

Thank you in advance for all the help.
Oct 3 '06 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.