删除表中重复数据,只删除重复数据中ID最小的

delete t_xxx_user where recid in (
select recid from t_xxx_user where recid in (
select min(recid) from t_sz_grid_forecast_user
where ddatetime = to_date('2019-12-17 16:00:00','yyyy-MM-dd hh24:mi:ss')
and forecaster = 'XXX' 
group by venueid,ybsx having count(ybsx) > 1
))

posted @ 2019-12-17 19:15  麦格雷超  阅读(350)  评论(0编辑  收藏  举报