题解 | 二刷

删除emp_no重复的记录,只保留最小的id对应的记录。

https://www.nowcoder.com/practice/3d92551a6f6d4f1ebde272d20872cf05

/*delete from
    titles_test
where
    titles_test.id not in (
        select
            t.minid
        from
            (
                select
                    min(id) minid
                from
                    titles_test
                group by
                    emp_no
            ) as t
    )
*/



























/*
#阅读理解,删除重复,对于重复的只保留最小id

delete from titles_test
where id not in
(select 
min(t1.id)
from(
select
* 
from titles_test 
)  as t1
group by t1.emp_no
)
*/

#阅读理解,删除重复,对于重复的只保留最小id
delete from  titles_test
where id not in
(select
min(t1.id)
from (select * from titles_test) as t1
group by t1.emp_no
)





全部评论

相关推荐

一颗宏心:华为HR晚上过了十二点后还给我法消息。
点赞 评论 收藏
分享
评论
点赞
收藏
分享
牛客网
牛客企业服务