Hello! i have a mysql problem - i need to execute a query which selects field from one table and joins another table which is determined by a field value in table 1. for example, table1 contains fields ID(primary int) and someotherfield(varchar). i need to join table2 or table3 depending on the someotherfield value. if someotherfield contains 'a', it joins table 2, if it contains 'b', it joins table3.
i tried to do it something like this:
SELECT * FROM table1 JOIN table2 ON table1.ID=table2.ID WHERE (table1.someotherfield='a') JOIN table3 ON table1.ID=table3.ID WHERE (table1.someotherfield='b')
however, it does not works. i get an error. any ideas?