表A,受理时间(s)一年内的重复致电(tel)3次以上的数量怎么查
select date_format(s,"%Y"),tel,count(1) from a group by date_format(s,"%Y"),tel having count(1)>3
按照这个思路去写。
select tel from(select count(s)num,tel from A group by tel)a where num > 3
select * from ()select count(distinct tel) as a,tel from A where s>='2020-01-01' )where a>=3