I trying to update menu_order if post_type product not have _thumbnail... Tried:
UPDATE phiz_posts SET menu_order = 1 WHERE ID IN (SELECT ID FROM phiz_posts LEFT JOIN phiz_postmeta ON phiz_posts.ID = phiz_postmeta.post_id AND phiz_postmeta.meta_key = '_thumbnail_id' WHERE post_type='product' AND phiz_postmeta.post_id IS NULL)
Error: You can't specify target table 'phiz_posts' for update in FROM clause
This sql return the list of product ID without _thumbnail correctly:
SELECT ID FROM phiz_posts LEFT JOIN phiz_postmeta ON phiz_posts.ID = phiz_postmeta.post_id AND phiz_postmeta.meta_key = '_thumbnail_id' WHERE post_type='product' AND phiz_postmeta.post_id IS NULL
How can change this ?
Best,