mysql update操作时not in的用法

今天想写条语句

UPDATE t_resource_structure SET second_root_id = '4F86397B-2B48-613B-3F2B-8ACB5A8B625B' 
where structure_id not in (SELECT structure_id FROM t_resource_structure WHERE structure_id = 'BADA453D-B319-54B9-9FA0-CFF4C771A833' OR is_xdkm_root = 1);

怎么执行都报错,后来发现,在mysql中需要这样写

UPDATE t_resource_structure SET second_root_id = '4F86397B-2B48-613B-3F2B-8ACB5A8B625B' 
where structure_id not in (SELECT a.structure_id FROM (SELECT * FROM t_resource_structure WHERE structure_id = 'BADA453D-B319-54B9-9FA0-CFF4C771A833' OR is_xdkm_root = 1) a);

还是不熟悉mysql啊。。。

posted @ 2013-02-21 15:43  东师理想--周枫  阅读(785)  评论(1编辑  收藏  举报