Skip to content

SQL Find Duplicate Record in a Table

Many times you may need to write a SQL to find duplicate record in a table. I wrote a SQL statement to find duplicate record in the table. There are two variant for same result. Try both of them and see which one is best for your job.

SELECT
state, district, market_center, crop, grade, MAX(date_arrival)
FROM crops
GROUP BY state, district, market_center, crop, grade
ORDER BY date_arrival
DESC

OR

SELECT DISTINCT state, district, market_center, crop, grade
FROM crops
ORDER BY date_arrival

If you have any other method, do drop a comment below.