Modify select query to return certain values based on particular values

Experts,
             I have the following query
Select EventType
FROM tablename
In the database EventType is either stored as a 0 or 1. Is it possible to modify the select query so that if EventType is 1 it returns "Open" and when it is zero it returns the string "Click"

Thanks,
Aditya
LVL 1
pmac38CDSAsked:
Who is Participating?
 
Guy Hengel [angelIII / a3]Connect With a Mentor Billing EngineerCommented:
select eventType, case EventType when 1 then 'Click' when 0 then 'Open' else '/' end EventType2 from tablename
0
 
HainKurtSr. System AnalystCommented:
use this in select

case EventType when 1 then 'Open' else 'Click' end EventType  
0
 
HainKurtSr. System AnalystCommented:
or

case
when EventType=1 then 'Open'
when EventType=0 then 'Click'
else 'NA'
end as EventType
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.