How can I use an if/else condition on a select statement in mysql?
If Type = "Initial Read", Select the Initial Column from table_name
else if Type = "Final Read", Select the Final Column from table_name
How should I do this? And what is the right query for this? Do i use case select?
Use CASE
SELECT CASE Type
WHEN "Initial Read" THEN Initial_Column
WHEN "Final Read" THEN Final_Column
END column
FROM table_name
WHERE <some condition>