How to run a given select statement based on condition?
If a condition (which comes from table_A) is true then select from table_B otherwise from table_C. Tables have no common column.
Something like this
select case when table_A.flag=true then
(select * from table_B )
else
(select * from table_C )
end
from table_A where ...
The above one will fail of course : more than one row returned by a subquery used as an expression
ifstatement?ifstatement is plain sql. It would work as followsif (select <column> from <table>) = <condition> then (select * from table) else (select * from other_table)