Forum Moderators: open
I need to do a branch type logic statement within a single SQL statement if at all possible.
Essentially what I have is a join across two tables. If a row does not exist in one table, I want to send the result from the other. If a row does exist in that table, I want to send that one.
Does that make sense ? Possible ?
Thanks!
Something like :
select product, price, '1' as table_num
from table1
union
select product, price, '2' as table_num
from table2
order by table_num asc
limit 0,1