在MySQL数据库表注释中,有超过20亿条记录,我必须从这个表中获取具有最大注释数的post_id:
select post_id,Count(id) as total from comments group by post_id但是,这给了我所有现有的帖子ids,上面的查询没有它们的注释。我只想让帖子id有最大的注释
发布于 2014-06-09 09:51:39
select post_id, Count(id) as total
from comments
group by post_id
order by total desc
limit 1https://stackoverflow.com/questions/24117663
复制相似问题