我正在使用:
SELECT l.name AS listName, COUNT(p.fk_list_identifier) AS countNum
FROM list AS l INNER JOIN person AS p
WHERE l.identifier = p.fk_list_identifier
GROUP BY l.name;
答案 0 :(得分:2)
如果您只想要没有参考的列表,您可以这样做:
SELECT l.name AS listName
FROM list l LEFT JOIN
person AS p
on l.identifier = p.fk_list_identifier
WHERE p.fk_list_identifier IS NULL
GROUP BY l.name;