Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Value substitution

Status
Not open for further replies.

gixer

MIS
Joined
Nov 8, 2001
Messages
15
Location
CA
Hi,

I'm trying to do a simple query with a value substitution.

In the table the value 'yes' is stored as an integer of 1 and the value 'no' is stored as an integer of 2.

select responded from test

If you run the query above here are the results:

responded
---------
1
2
1
1

How would I write the query so it would return the following results:

responded
---------
yes
no
yes
yes

Thanks for any help!!



 
Hi,

Try this........

Select CASE responded when 1 then 'Yes' Else 2 END From TBL

Hope it helps
Sunil
 
Thanks Sunil.

One more question. How do you do a column alias with a case statement?
 
Got it. END as columnalias

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top