如果有开窗函数建议用开窗。如果没有开窗可以使用
select * FROM `tb_pkdf_ods` a
where (店,CHECK_DATE) in (
select t1.店,t1.CHECK_DATE from `tb_pkdf_ods` t1
left join `tb_pkdf_ods` t2
on t1.店=t2.店
and t1.CHECK_DATE>t2.CHECK_DATE
group by t1.店,t1.CHECK_DATE
having count(distinct t2.CHECK_DATE)<=3)