标签: mysql sql
我想获得总行数并获取行数。我有类似的东西
SELECT count(id), id FROM post LIMIT 10;
答案 0 :(得分:0)
内部查询获取计数并使用join您可以获得所需的数据!
select a.*,b.count from post a join (SELECT count(id) as count, id FROM post group by id) b on a.id=b.id;