mysql count group by統計條數方法
mysql 分組之後如何統計記錄條數? gourp by 之後的 count,把group by查詢結果當成一個表再count一次 select count(*) as count from (SELECT count(*) FROM 表名 WHERE 條件 GROUP BY id ) a;
實戰例子: select count(*) as total from (select count(*) from users group by user_id) u
轉載:流風,飄然的風,博客網站:http://www.ssqhm.com