How do you count the rows in a SQL query which already used count, group by, and having before? -
for example, using answer question:
how select users made more 10 submissions "how select users made more 10 submissions."
select userid submission group userid having count(submissionguid) > 10
let's want know many rows sql statement outputted. how scalable solution counting rows of counting rows?
slight error in posted example, need alias table name subquery:
select count(*) (select userid submission group userid having count(submissionguid) > 10) t
i'm not sure scalability, solution. if isn't scaling enough you, need consider major design changes, perhaps tracking submitted more 10 submissions in separate table update through applications populate submissions. or many other possible solutions.
Comments
Post a Comment