我正在使用计数:
SELECT l.identifier AS id, l.name AS listName, COUNT(p.list_identifier)
AS regCount FROM list AS l LEFT JOIN person AS p ON l.identifier = p.list_identifier
WHERE p.list_identifier IS NULL GROUP BY l.name;
请帮帮我。
答案 0 :(得分:0)
尝试使用left outer join& COUNT(DISTINCT ...)
SELECT COUNT(DISTINCT l.identifier) AS regCount
FROM list AS l LEFT OUTER JOIN person AS p ON l.identifier = p.list_identifier
WHERE l.Name LIKE '%a%'