删除重复数据并保留一条

2021-05-31  本文已影响0人  S等价交换S

delete from employee where objuid in (

SELECT

objuid

FROM

(

SELECT

objuid

FROM

employee

WHERE

wx_id IN (

SELECT

wx_id

FROM

employee

GROUP BY

wx_id

HAVING

count(*) > 1

)

AND objuid NOT IN (

SELECT

min(objuid)

FROM

employee

GROUP BY

wx_id

HAVING

count(*) > 1

)

ORDER BY

user_name

) a)

上一篇下一篇

猜你喜欢

热点阅读