我试图在我的列“ meta_value”的所有元素中插入新值,这是我认为不错的代码,但它显示了一个错误:
@Hrishi实际上我正在尝试更新现有数据,我以特定的meta_key(order_by_first_post)为目标,我想将列'meta_value'的所有对应值初始化为零,这是我的基础图像:
insert into wp_postmeta (post_id, meta_key, meta_value)
select ID, 'order_by_first_post', '0'
from wp_posts
WHERE post_type = 'recipes';
谢谢大家的帮助,这就是我所期望的。下次,我将尽力澄清我的问题:
INSERT INTO wp_postmeta (post_id, meta_key, meta_value)
SELECT wp_posts.ID, 'order_by_first_post', '0'
FROM wp_posts
WHERE wp_posts.post_status = 'publish' and wp_posts.post_type = 'recipes'";