I have two tables which are combined via a MAP table
Table ANIMAL:
+------+--------------+
| id | description |
+------+--------------+
| 2 | Ape |
| 3 | Lion |
+------+--------------+
Table MAP:
+-----------+---------+
| animal_id | legs_id |
+-----------+---------+
| 2 | 11 |
+-----------+---------+
Table LEGS:
+------+--------------+
| id | legs |
+------+--------------+
| 10 | 4 |
| 11 | 2 |
+------+--------------+
I need the animals that have no map entry in the LEGS table, something like this:
!(select *
from ANIMAL as a
JOIN MAP as m ON (a.id = m.animal_id)
JOIN LEGS as l ON (m.legs_id = l.id) )
which should give me ‘Lion’ as result
use
LEFT JOINTo further gain more knowledge about joins, kindly visit the link below: