I cannot find an answer to this seemingly easy problem. I need to execute a different SELECT statement based on a condition.
A simple example :
if <condition>
SELECT id FROM table;
otherwise
SELECT id FROM table WHERE variable=1;
In other words I need to add an additional WHERE clause depending on the condition, however the problem boils down to choosing a different SELECT clause based on whether the condition is true or false.
condition?