E.g. lets say you have ‘table’ with column ‘slug’ and then there are 3 records with the same slug value and you want to remove 2nd, 3rd but keep the 1st.
select * FROM table a INNER JOIN table b ON a.slug = b.slug WHERE a.id > b.id;
You create an inner join on the same table – joining them by the column that the row duplicates are based on – in this case, column ‘slug’. What this select outputs are exactly the rows you wish to delete – 2nd and 3rd row.
Because in WHERE clause we specify that only those rows that have ID higher than the first occurrence.
Now to actually delete these records, you just put a delete in front, e.g.
delete from table where id IN (select id FROM table a INNER JOIN table b ON a.common_column = b.common_column WHERE a.id > b.id);
Webmentions
nejlepší cena na kamagra
levná obecná kanada kamagra
buy xifaxan generic good
buying xifaxan cheap online in the uk
how to buy avodart generic from canadian pharmacy
no prescription avodart overnight
cheap staxyn uk suppliers
ordering staxyn usa cheap
buy cheap itraconazole without prescription
purchase itraconazole generic how effective
fildena canada pharmacy
ordering fildena buy online no prescription
buy gabapentin cost at costco
online order gabapentin purchase usa
cheapest buy flexeril cyclobenzaprine us pharmacies
cheapest buy flexeril cyclobenzaprine usa pharmacy
purchase dutasteride generic release date
how to buy dutasteride generic uk
enclomiphene with free dr consultation
no prescription enclomiphene with fedex
kamagra livraison fedex
generique kamagra en suisse acheter
rifaximin no prescription usa fedex shipping
rifaximin online no perscription overnight
how to buy androxal us pharmacies
how to buy androxal cheap pharmacy