我一开始使用的Sql:
update cms_product_provider_properties set value = '广东' where attribute_id in (select id from cms_provider_properties_view b ON a.attribute_id = b.id where b.name ='产地' and (b.value is null or b.value = ''))
这种方法不行
之后使用:
update cms_product_provider_properties set value = '广东' where attribute_id in (
SELECT a.attribute_id FROM (select tmp.* from cms_product_provider_properties tmp) a
Inner Join cms_provider_properties_view b ON a.attribute_id = b.id
where b.name ='产地' and (b.value is null or b.value = ''))
网上说是可以,但我却不行。。。。
再之后:
update cms_product_provider_properties a Inner Join cms_product_type_attribute b ON a.attribute_id = b.id
and b.name ='产地' and (a.value ='') set a.value = '广东'
终于OK。。。。。
本文记录了博主在使用SQL更新特定属性值过程中遇到的问题及解决办法。最初尝试使用嵌套查询的方法进行更新,但未成功。最终通过内连接的方式实现了对指定属性为空或为空字符串的数据进行更新。
1170

被折叠的 条评论
为什么被折叠?



