Last active
March 17, 2017 01:52
-
-
Save manhdaovan/11dfc7ec958042bb068e21e2c4fca980 to your computer and use it in GitHub Desktop.
Remove duplicate rows on tables
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Remove duplicate rows on table by simple query. | |
Repeate until no more query is removed */ | |
delete from shop_product_price | |
where id in | |
(select tmp.id from | |
(select *, count(*) as num from shop_product_price | |
group by shop_id, product_id, price, min_quantity, shipping_fee | |
having num >= 2) as tmp); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment