列を追加します、total 、例:
select t.*
, (select count(*) from tbl where col = t.col) as total
from tbl t
where t.col = 'anything'
limit 5
@Tim Biegeleisenが述べたように :limit キーワードは他のすべての後に適用されるため、count(*) それでも正しい答えを返します。
列を追加します、total 、例:
select t.*
, (select count(*) from tbl where col = t.col) as total
from tbl t
where t.col = 'anything'
limit 5
@Tim Biegeleisenが述べたように :limit キーワードは他のすべての後に適用されるため、count(*) それでも正しい答えを返します。