添加一列,
total例如:
select t.* , (select count(*) from tbl where col = t.col) as totalfrom tbl twhere t.col = 'anything'limit 5
如 @Tim Biegeleisen所述 : limit
关键字在所有其他内容之后应用,因此count(*)
仍然返回正确的答案。

添加一列,
total例如:
select t.* , (select count(*) from tbl where col = t.col) as totalfrom tbl twhere t.col = 'anything'limit 5
如 @Tim Biegeleisen所述 : limit
关键字在所有其他内容之后应用,因此count(*)
仍然返回正确的答案。