一张表,有id、name、no三个字段,查询一个no对应三个以上name的记录。这个sql应该如何写?
select *, count(*) as num
from table
group by no
having num > 3
应该是这样吧
select no from table group by no having count(*)>3;
一张表,有id、name、no三个字段,查询一个no对应三个以上name的记录。这个sql应该如何写?
select *, count(*) as num
from table
group by no
having num > 3
应该是这样吧
select no from table group by no having count(*)>3;