mysql count group by统计条数方法
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
SELECT count(*) from (SELECT post_ask.ask_id,post_ask.ask_body,post_ask.ask_user,post_answer.answer_body,post_answer.answer_user from post_ask right JOIN post_answer on post_ask.ask_id = post_answer.ask_id and post_answer.answer_body is not null where post_ask.ask_id
is not null and post_ask.ask_body <>"" GROUP BY post_ask.ask_id ) as u
声明:该文观点仅代表作者本人,入门客AI创业平台信息发布平台仅提供信息存储空间服务,如有疑问请联系rumenke@qq.com。