I am using the following query to find duplicate records and have verified it runs correctly.
SELECT MLS_LISTING_ID, STREET_NUMBER, STREET_NAME, UNIT_NUMBER, MLS_ID, SALE_PRICE, ZIP_CODE, TLN_REALTOR_ID, COUNT(mls_id)
FROM idx_FM_BO_NA
GROUP BY TLN_REALTOR_ID, STREET_NUMBER, STREET_NAME, UNIT_NUMBER, SALE_PRICE
HAVING COUNT(distinct MLS_ID) > 1;
How do I alter this query to delete duplicates so that there is only one instance of the record? I don’t worried which record(s) get deleted, but I need one of them to stay.
I think this answer is correct:
The only difference between this one and paulsm4’s answer that the ids are compared using less-than rather than not-equals. That way, later are not compared with earlier records (which means that one and only one of the identical records will be kept). I tested this out with my own data that I needed this for, and it worked.