Answer the question
In order to leave comments, you need to log in
How to remove Oracle SQL duplicates?
I have a table with multiple columns. Some columns have duplicate values. It is necessary to delete those rows where values are repeated in columns
For example
item column column1 column 2
And similarly, you need to display all duplicate rows
Answer the question
In order to leave comments, you need to log in
Output of duplicates:
SELECT t1.*
FROM table t1
WHERE EXISTS ( SELECT NULL
FROM table t2
WHERE t1.id <> t2.id -- выражение первичного ключа
AND t1.column = t2.column -- для всех полей, кроме первичного ключа
DELETE
FROM table t1
WHERE EXISTS ( SELECT NULL
FROM table t2
WHERE t1.id > t2.id -- оставить только запись с минимальным ID
AND t1.column = t2.column
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question