我要删除2015-10-19日的wdinfo字段重复的数据
(1)先查出数据
SELECT id, wdinfo
FROM BUSINISS
where starttime = to_date('2015-10-19', 'yyyy-mm-dd')
order by id desc
(2)查出这些重复数据的重复次数
select min(id),count(*) from (SELECT id, wdinfo
FROM BUSINISS
where starttime = to_date('2015-10-19', 'yyyy-mm-dd')
order by id desc) group by wdinfo
(3)最后留下最小id的数据,其他的重复数据删除
delete from businiss where id not in (select min(id) from (SELECT id, wdinfo
FROM BUSINISS
where starttime = to_date('2015-10-19', 'yyyy-mm-dd')
order by id desc) group by wdinfo )