select device_id from( select a.device_id,a.m m1,a2.m m2 from (select device_id,month(event_date) m,count(*) from question_practice_detail group by device_id,m having count(*)>1)a left join (select device_id,if(month(event_date)=1,...