SQL Statement to delete both posts and postmeta based on post_parent
-
I have a catalog of items that are posts with postmeta attached to them. I am looking to delete all posts with a specific post_parent value and the associated postmeta.
Using phpMyAdmin I want to execute an SQL query that will accomplish this. I thought this would work but it doesn’t:
DELETE FROM
wp_posts
,wp_postmeta
WHERE post_parent = 261 AND post_id = id;There is an obvious syntax error but I am unsure where or more specifically why.
#1064 – You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘WHERE post_parent = 261 AND post_id = id’ at line 1
Any help is greatly appreciated.
- The topic ‘SQL Statement to delete both posts and postmeta based on post_parent’ is closed to new replies.