同问题一样,用更好的方式来撰写:
SELECT clients_lists.*,
COUNT(clients_lists_relationships.clientid)
FROM clients_lists
LEFT JOIN clients_lists_relationships
ON clients_lists.listid = clients_lists_relationships.listid
WHERE clients_lists.parentid = 1
GROUP BY clients_lists.listid;