[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


SQL doubt

Posted on 2009-12-29
Medium Priority
Last Modified: 2012-05-08
Hi I have set of data like this..

Status1  Status2
0             1
0             0
1             0
0             1

i need to write a qry to display this records as

Status1       Status2
Incomplete   Complete
Incomplete  Incomplete  
complete     Incomplete  
Incomplete  complete  

Nothing but instead of 0 need to put Incomplete and instead of 1 need to put Complete .. can any one help me to write a oracle sql query .. i can not use pl/sql here ..  i need to use sql alone..
Question by:joe_suganth
LVL 75

Expert Comment

by:Aneesh Retnakaran
ID: 26141148
SELECT CASE Status1 WHEN 0 THEN 'incomplete' else 'Complete' end  as status1 , CASE Status2 WHEN 0 THEN 'incomplete' else 'Complete' end  as status2
from yourTable
LVL 143

Accepted Solution

Guy Hengel [angelIII / a3] earned 2000 total points
ID: 26141149
so, this is for oracle?

select decode(status1, 0, 'Incomplete', 1, 'Complete', 'N/A') Status1,
decode(status2, 0, 'Incomplete', 1, 'Complete', 'N/A') Status2
 from yourtabel

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

If you find yourself in this situation “I have used SELECT DISTINCT but I’m getting duplicates” then I'm sorry to say you are using the wrong SQL technique as it only does one thing which is: produces whole rows that are unique. If the results you a…
Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

834 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