update instock as s inner join
(select sc.sale_channel_name, scsh.store_house_id as id
from sale_channel as sc
left join sale_channel_store_house scsh on sc.sale_channel_id = scsh.sale_channel_id) as t
on s.store_id = t.id
set s.label = t.sale_channel_name where s.label is null;
Mysql 关联多表并更新表操作
最新推荐文章于 2024-07-02 09:36:06 发布
这篇博客探讨了一个SQL查询,该查询通过左连接(LEFT JOIN)将销售通道表(sale_channel)与销售通道商店库表(sale_channel_store_house)联接,以更新库存标签为销售通道名称。查询主要涉及store_id和sale_channel_id的匹配,并且仅当原有标签为空时才进行更新操作。
摘要由CSDN通过智能技术生成