MySql 5.x Version Update时用到select时发生的问题

我一开始使用的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。。。。。
posted on 2011-04-17 19:19  TankMa  阅读(364)  评论(0编辑  收藏  举报