所以我有这个查询,它给出了一个id列表,以及它们在特定表中重复的次数。虽然该表非常大,但我无法确定如何计算查询返回的行数。
我在桌子上尝试了自我加入和“IN”条款,但无法让它们起作用
有什么想法吗?
select id, count(*) as C
from tblProduct
group by id
having count(*) > 2
order by C desc
答案 0 :(得分:1)
select count(*) from (select id, count(*) as C
from tblProduct
group by id
having count(*) > 2
) mytable