如表A id name gid 1 jerry 1 2 tom 1 3 lucy 2 表B gid name 1 cartoon 2 real 3 super 期望的到结果 gid name count 1 cartoon 2 2 real 1 3 super 0 解决办法: SELECT B.gid,B.name, COUNT(A.gid) COUNT FROM B LEFT JOIN A ON A.gid=B.GID GROUP BY B.gid,B.name