Here’s my code:
INSERT final_deduped2
SELECT * FROM (
SELECT *
FROM final_deduped
ORDER BY id DESC
) AS tmp_table GROUP BY address
I wrote it to insert the address with the highest id (no dupes) into the table called final_deduped2.
Also, I’m under the impression that ORDER BY and GROUP BY can’t be used in the same SELECT.
I’ve checked my results manually and believe my script did what I need it to do, but there are now 70K+ rows in final_deduped2.
Can you see bad practices or any reason to think that my satisfaction is just a coincidence?