Can some one explain me how to use conditions (if-else) in a query for joining two tables.
Is it possible?
Thanks in advance.
you cannot make joining conditional -- you either join or you don't
you might want it to be a LEFT OUTER JOIN, though, which is sort of conditional -- join to matching rows if they exist, otherwise return just the data from the left table
you will have to give more information if you want more help
You can join on an conditional expression, though, like in
SELECT * FROM a JOIN b on a.something = if(b.something_else, value1, value2)
so what was the final solution?