I spent some time in my WP DB trying to figure out how I can clean out some completed order data. Below is the query that I am confident will help remove order data from all of the different tables.
But when I run the following query:
DELETE * FROM wp_post
JOIN wp_postmeta ON wp_post.ID = wp_postmeta.post_id
JOIN wp_woocommerce_order_items ON wp_postmeta.post_id = wp_woocommerce_order_items.order_item_id
JOIN wp_woocommerce_order_itemmeta ON wp_postmeta.post_id = wp_woocommerce_order_itemmeta.order_item_id
WHERE wp_post.post_type = "shop_order"
AND wp_post.post_status = "wc-completed"
I get the following MySQL error:
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '* FROM wp_post
JOIN wp_postmeta ON wp_post.ID = wp_postmeta.post_id
JOIN wp_wo' at line 1
Am I not JOIN my WordPress Tables correctly?
This question may be more appropriate for stackoverflow but figured I would try here first.
* FROM?DELETErequires that you list the tables you want to delete from betweenDELETEandFROM.