最近在 mysql 中做了一个查询
select count(*) from
(select a,b,count(distinct c) from table group by a,b having count(distinct c)>=2) as t
把 mysql 库跑死掉了
请教下有什么可以优化的空间?
目前想到的是下面
select count(*) from
(select a,b from table group by a,b having count(distinct c)>=2) as t
select count(*) from
(select a,b,count(distinct c) from table group by a,b having count(distinct c)>=2) as t
把 mysql 库跑死掉了
请教下有什么可以优化的空间?
目前想到的是下面
select count(*) from
(select a,b from table group by a,b having count(distinct c)>=2) as t