我正在尝试按特定类别中某些产品的百分比提高价格。我想出了应该工作的 select 语句,但是我无法将它与 update 语句结合起来。这是我所拥有的:
SELECT * from `wp_term_relationships` where term_taxonomy_id=376 and object_id in(select ID from `wp_posts` where `post_type`='product' and post_status='publish' and ID=wp_term_relationships.object_id)
Run Code Online (Sandbox Code Playgroud)
这给了我我需要的产品。我可以在这些产品上运行更新(如下所示)还是需要以某种方式组合它们?
update wp_postmeta set meta_value = meta_value * 1.40 where meta_key='_regular_price'
Run Code Online (Sandbox Code Playgroud)