当使用下面的查询时,我正在插入product_id,我还想为所有插入的product_id设置字段category_id = 4。这是我插入产品的代码。
INSERT INTO lc_products_to_categories
( product_id)
SELECT product_id
FROM lc_products_info
where name like '%awesome product%'
如何使用单个查询更新category_id?
答案 0 :(得分:0)
INSERT INTO lc_products_to_categories
( product_id, category_id)
SELECT product_id, 4
FROM lc_products_info
where name like '%awesome product%'