Convert the numbers in field to text format using SQL query using report

Hi Connection,

image
As above image is from the report. Where I am getting the data from the data base but while taking the need to convert the Number to test VIA SQL Query

I have 3 sets of data
0 = not started
1 = InProgress
2 = Completed
How do I convert this above mentioned Number in to the text.

Thanks,
Connection

You do it in the SQL query. Which SQL database server are you using?

Oracle SQL data base Sever I am using. can I know how I do can execute in the query?

Use the CASE ... WHEN ... syntax. It should be something like this if the number value is in column3:

SELECT
    column1,
    column2,
    CASE column3
        WHEN 2 THEN 'Completed'
        WHEN 1 THEN 'In Progress'
        ELSE 'Not started'
    END Status,
    column4
FROM ...

You will find plenty of examples on the web.

1 Like

The way I handle this is to create a new table for status and then connect them via the ID columns. I find it easier to maintain the SQL queries long term this way. However if creating a new table is not an option, then the solution given by @Transistor is your best bet.
9B3PDiW

2 Likes