我有两个通过 MAP 表组合的表
Table ANIMAL:
+------+--------------+
| id | description |
+------+--------------+
| 2 | Ape |
| 3 | Lion |
+------+--------------+
Table MAP:
+-----------+---------+
| animal_id | legs_id |
+-----------+---------+
| 2 | 11 |
+-----------+---------+
Table LEGS:
+------+--------------+
| id | legs |
+------+--------------+
| 10 | 4 |
| 11 | 2 |
+------+--------------+
我需要在 LEGS 表中没有地图条目的动物,如下所示:
!(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) )
结果应该给我“狮子”