希望使用以下SQL脚本通过单个查询从整个数据库中删除所有旧帖子和相关记录。我遇到的问题是DB中有112个子域(448个表)(WordPress为每个子域以数字方式区分创建单独的表),我无法正确合并表名通配符。原样,脚本一次只从每个表中删除一个子域。
delete a,b,c,d
FROM wp_112_posts a
LEFT JOIN wp_112_term_relationships b ON ( a.ID = b.object_id )
LEFT JOIN wp_112_postmeta c ON ( a.ID = c.post_id )
LEFT JOIN wp_112_term_taxonomy d ON ( d.term_taxonomy_id = b.term_taxonomy_id )
AND a.post_type = 'post'
AND DATEDIFF(NOW(), a.post_date) > 30