I am trying to write a SQL query where the if the output is 'FRUIT' a temp table 'FRUIT' is created with a column 'FOOD_TYPE' and if not, then a temp table 'VEGETABLE' is created with a column 'FOOD_TYPE'.
Can somebody please help me?
Here is the initial query I wrote.
select *, (CASE WHEN food LIKE 'APPLE' THEN 'FRUIT' ELSE 'VEGETABLE' END) AS FOOD_TYPE from temptable
Aucun commentaire:
Enregistrer un commentaire