I'm trying to find broken links between two tables.
Performing that I can view all the links
Code:
SELECT
t2.name AS "object",
t1.name AS "group"
FROM
t2
LEFT JOIN t1 ON (t1.t1_id = t2.t1_id)
I get get something like that
Code:
+---------+-----------+
| object | group |
+---------+-----------+
| apple | food |
| bus | vehicule |
| car | vehicule |
| chair | furniture |
| cheese | food |
| coat | cloth |
| metro | vehicule |
| noze | |
| table | furniture |
| water | |
| window | |
| wine | |
+---------+-----------+
But i'm trying to get only the broken ones (objects having no group)
Code:
SELECT
t2.name AS "object",
t1.name AS "group"
FROM
t2
LEFT JOIN t1 ON (t1.t1_id = t2.t1_id)
WHERE
t1.name = NULL
I'd like to get
Code:
+---------+-----------+
| object | group |
+---------+-----------+
| noze | |
| water | |
| window | |
| wine | |
+---------+-----------+
But this one gives me an empty result