我怎么能unique row id不unique row id存在?
我的桌子是
col1 col2 col3 col4 col5 col6 col7
john 1 1 1 1 1 1
john 1 1 1 1 1 1
sally 2 2 2 2 2 2
sally 2 2 2 2 2 2
Run Code Online (Sandbox Code Playgroud)
我希望在重复删除后留下以下内容:
john 1 1 1 1 1 1
sally 2 2 2 2 2 2
Run Code Online (Sandbox Code Playgroud)
我已经尝试了一些查询,但我认为它们依赖于行ID,因为我没有得到理想的结果.例如:
DELETE
FROM table
WHERE col1 IN (
SELECT id
FROM table
GROUP BY id
HAVING (COUNT(col1) > 1)
)
Run Code Online (Sandbox Code Playgroud)