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.
1 2 3 4 5 6 7 8 | 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
1 2 3 4 5 | 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.