Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一张桌子:
A 1 1 1 2
我想变成
A 1 2
我怎么可能做到?谢谢
应该可以通过使用 ROW_NUMBER OLAP 函数对重复项进行编号来直接删除:
DELETE FROM ( SELECT A, ROW_NUMBER() OVER (PARTITION BY A) AS RN FROM my_table ) WHERE RN > 1
在编写上述内容时,我依赖于这个讨论。