求SQL代码分析过程
User_Idname
11
21
32
43
52
63
74
85
表名:Bse_User,删除重复的Name中User_Id比较小的记录。
[解决办法]
delete from bse_user a
where exists (select 1 from (select min(user_id)userid,name from bse_user group by name) b
where a.user_id=b.user_id and a.name=b.name)
delete a
from (select *,row_number()over(partition by Name order by User_ID desc) as Row from Bse_User) as a
where Row>1