As per the above requirement , below query may do the trick.
DELETE FROM table_name where
CUST_ID in
(SELECT CUST_ID from table_name
GROUP BY CUST_ID HAVING COUNT(*) > 1) ;
This query will delete all the dups, but the requirement was to keep 1 record among the duplicate records. So ineffect the below records will not be present in the output.
DELETE FROM table_name where
CUST_ID in
(SELECT CUST_ID from table_name
GROUP BY CUST_ID HAVING COUNT(*) > 1) ;
The inner query will return all the CUST_ID which has rows more than one,
and the outer query will delete all the rows which was returned by the inner query.
but as per the above requirement,
One occurance should be kept... not all of them to be deleted.
e.g:
1
1
1
2
2
then the output shud be
1
2
...