[Solved] How to remove unique rows based on customer name using sql query?


You can use the following query:

SELECT cust_name
FROM mytable
GROUP BY cust_name
HAVING COUNT(*) > 1

to get the cust_name values of duplicate records.

Use this query as a derived table and join back to the original table to get the desired result:

SELECT t1.*
FROM mytable AS t1
JOIN (
   SELECT cust_name
   FROM mytable
   GROUP BY cust_name
   HAVING COUNT(*) > 1
) AS t2 ON t1.cust_name = t2.cust_name

1

solved How to remove unique rows based on customer name using sql query?