How can I find duplicate rows and for each group of duplicate rows delete the max ID row, in MySQL?
Using this query, I can find duplicate rows:
SELECT * , COUNT( awb_no ) c
FROM tbl_cod_rpt_COPY
GROUP BY awb_no
HAVING c >1
And this query gives me the maximum ID for each group:
SELECT * , MAX( tbl_cod_rpt_id )
FROM tbl_cod_rpt_COPY
GROUP BY awb_no
HAVING COUNT( awb_no ) >1
Now how would I delete the tbl_cod_rpt_COPY rows matching the MAX( tbl_cod_rpt_id ) values from the query above?