Reputation: 3844
My Food
table has columns Name
, Food Group
, and Healthy
. Healthy
is a boolean represented by INTEGER 1 for healthy foods and 0 for unhealthy foods. I want a query that returns all three columns but for Healthy
I want it to return "Eat me" for healthy foods and "Avoid me" for unhealthy foods.
How do I write this query using only a SELECT
statement?
Upvotes: 0
Views: 71
Reputation:
You can use CASE expression here like:
select Name, case Healthy when 1 then "Eat me" else "Avoid me" end from Food;
Upvotes: 1