Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
I'm trying to select an integer field as text but I have no idea how to do it.
The 1 represents low, the 2 represents medium, and 3 represents hi.
1
low
2
medium
3
hi
you can do this with CASE WHEN
CASE WHEN
SELECT (CASE WHEN column = 1 THEN "low" WHEN column = 2 THEN "medium" WHEN column = 3 THEN "high" END) AS value FROM table_name;
Add a comment
SELECT CASE intfield WHEN 1 THEN 'low' WHEN 2 THEN 'medium' WHEN 3 THEN 'hi' END AS inttext FROM table
Select CASE WHEN field = 1 then 'low' WHEN field = 2 then 'medium' WHEN field = 3 then 'hi' END as Col from yourtable;
Required, but never shown
By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.
Start asking to get answers
Find the answer to your question by asking.
Explore related questions
See similar questions with these tags.