How can i join multiple tables not depending on LEFT or RIGHT join
example:
t1
id | date
-----------
NULL NULL
t2
id | value
------------
1 | bla
SELECT date,value
FROM t2 LEFT JOIN t1
ON t1.id = t2.id where t2.id = 1
— select is ok
with right join same query return null values …
Edit:
That will return all records, even if there is no match on those joining fields.Sorry, that will give you syntax error. See my edit down below.If you only want matches, use
inner join:Edit: There is no
FULL OUTER JOINin MySQL. You will have to simulate it withUNIONand combine aLEFTandRIGHTJOIN:This will also return your
NULLvalues, but they will not match, asNULL != NULL