Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Modify select query to return certain values based on particular values

Posted on 2011-02-17
3
Medium Priority
?
237 Views
Last Modified: 2012-05-11
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
0
Comment
Question by:pmac38CDS
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 2000 total points
ID: 34917437
select eventType, case EventType when 1 then 'Click' when 0 then 'Open' else '/' end EventType2 from tablename
0
 
LVL 60

Expert Comment

by:HainKurt
ID: 34917527
use this in select

case EventType when 1 then 'Open' else 'Click' end EventType  
0
 
LVL 60

Expert Comment

by:HainKurt
ID: 34917551
or

case
when EventType=1 then 'Open'
when EventType=0 then 'Click'
else 'NA'
end as EventType
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Data architecture is an important aspect in Software as a Service (SaaS) delivery model. This article is a study on the database of a single-tenant application that could be extended to support multiple tenants. The application is web-based develope…
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question