Let's say I have a TABLE a in which a COLUMN data is the one to join on for 2 other tables (TABLE b and TABLE c) because I want to get a COLUMN info in b or c.
The thing is a.data will match only with b.data or only with c.data.
- How can I get
b.infoorc.infobased ona?
How far did I try:
After many attempts with obviously wrong syntax, the best I did was in 2 queries:
SELECT b.info FROM a INNER JOIN b ON a.data = b.data
SELECT c.info FROM a INNER JOIN c ON a.data = c.data
I would like to achieve something that could look like this:
SELECT alias.info FROM a INNER JOIN (b OR c) AS alias ON a.data = alias.data
Why do I want to do this
Actually I can get the data I want and work with it using PHP. But I am making a huge process (unrelated to my question) instead of a good query and the page takes too much time to load.