Connecting Tech Pros Worldwide Help | Site Map

Sql Case Statement

Newbie
 
Join Date: Oct 2006
Posts: 7
#1: Oct 3 '06
Hi,
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.
salex
Reply


Similar PostgreSQL Database bytes