2019独角兽企业重金招聘Python工程师标准>>>
--查询重复数据
select *
from app_jf_value t1
where (t1.jfindcode, t1.areacode, t1.kpitype, t1.created_at) in
(select jfindcode, areacode, kpitype, created_at
from app_jf_value
group by jfindcode, areacode, kpitype, created_at
having count(*) > 1);
--删除重复数据
delete from app_jf_value t1
where (t1.jfindcode, t1.areacode, t1.kpitype, t1.created_at) in
(select jfindcode, areacode, kpitype, created_at
from app_jf_value
group by jfindcode, areacode, kpitype, created_at
having count(*) > 1)
and rowid not in
(select min(rowid)
from app_jf_value
group by jfindcode, areacode, kpitype, created_at
having count(*) > 1);