Last active
April 28, 2017 18:54
-
-
Save inogo/9c173bfc7e8ef3d5154ec2f0e901144d to your computer and use it in GitHub Desktop.
Delete old OpenCart orders
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
DELETE `or`, ort FROM `order_recurring` `or`, `order_recurring_transaction` `ort` WHERE order_id IN (SELECT order_id FROM `order` where order_id < 14000) AND ort.order_recurring_id = `or`.order_recurring_id; | |
DELETE FROM `order_product` WHERE order_id IN (SELECT order_id FROM `order` where order_id < 14000); | |
DELETE FROM `order_option` WHERE order_id IN (SELECT order_id FROM `order` where order_id < 14000); | |
DELETE FROM `order_voucher` WHERE order_id IN (SELECT order_id FROM `order` where order_id < 14000); | |
DELETE FROM `order_total` WHERE order_id IN (SELECT order_id FROM `order` where order_id < 14000); | |
DELETE FROM `order_history` WHERE order_id IN (SELECT order_id FROM `order` where order_id < 14000); | |
DELETE FROM `affiliate_transaction` WHERE order_id IN (SELECT order_id FROM `order` where order_id < 14000); | |
DELETE FROM `order` WHERE order_id < 14000; | |
DELETE FROM `sbacquiring` WHERE num_order < 14000; -- optional | |
OPTIMIZE TABLE `order`; | |
OPTIMIZE TABLE `order_product`; | |
OPTIMIZE TABLE `order_option`; | |
OPTIMIZE TABLE `order_history`; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment