gpt4 book ai didi

sql - 如果在 SQL 中有几行重复,如何只删除几行?

转载 作者:搜寻专家 更新时间:2023-10-30 23:34:25 24 4
gpt4 key购买 nike

如果有几行重复,如何只删除几行(多于 1 行)?当我尝试放置条件时,所有行都被删除。我正在使用 SQL Server 2008。

最佳答案

使用top命令删除

DELETE TOP(n) TableName
WHERE (Condition which pulls duplicate rows)
where n is the number of rows to delete.

关于sql - 如果在 SQL 中有几行重复,如何只删除几行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44931667/

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