根据b表中的b_1字段值更新a表中的a_1字段update a表 set a_1字段='值' where b_1字段 in(select * from b表 where b_1字段 like '%关键字%')
以上这段sql错在哪里?
求正确的写法

解决方案 »

  1.   

    update a表 set a_1字段='值' where b_1字段 in(select b_1字段 from b表 where b_1字段 like '%关键字%')
      

  2.   

    update a表 set a_1字段='值' where b_1字段 in(select b_1字段 from b表 where b_1字段 like '%关键字%')
    不对,提示错误
    Unknown column 'b_1字段' in 'IN/ALL/ANY subquery'
    SQL执行失败,请检查SQL语句是否正确[?]
      

  3.   

    update a表 set a_1字段='值' where b_1字段 in(select id from b表 where b_1字段 like '%关键字%')
      

  4.   

    update a表 set a_1字段='值' where id in(select id from b表 where b_1字段 like '%关键字%')
    where id才正确
    不过还是谢谢大神给我启发
      

  5.   

    update a表 set a_1字段='值' where b_1字段 我就一直想问  sql语句的主干部分只有一张a表 为什么 子语句where 直接出现b_1字段 作为判断条件~