gpt4 book ai didi

sql - SQL中如何删除重复记录

转载 作者:行者123 更新时间:2023-12-02 05:55:06 26 4
gpt4 key购买 nike

如何删除sql中的重复记录?

最佳答案

SQL Server 2005 及更高版本中:

WITH    q AS
(
SELECT *, ROW_NUMBER() OVER (PARTITION BY dup_column ORDER BY dup_column) AS rn
FROM mytable
)
DELETE
FROM q
WHERE rn > 1

关于sql - SQL中如何删除重复记录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2191854/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com