UPDATE TbTest SET num=1 WHERE strId IN(SELECT ...)//条件是一个字段strId的更新语句如果是两个字段strId,strCode in(select...),这样写不正确,有什么办法实现“条件是两个字段”的更新语句?

解决方案 »

  1.   

    本帖最后由 josy 于 2010-12-17 13:43:46 编辑
      

  2.   


    update TbTest  set  num=1
    from TbTest   a inner join  TbTest2 b on a.strId = b.strId  and a.strCode = b.strCode 
      

  3.   

    UPDATE TbTest SET num=1 WHERE exists (SELECT a,b,c from temp)
      

  4.   


    UPDATE tbtest 
    SET num=1
    FROM tbtest t1, others t2
    WHERE t1.strid=t2.strid and t1.strcode=t2.strcode;
    -- or
    UPDATE tbtest t
    SET num=1
    WHERE exists (select * from others where strid=t.strid and strcode=t.strcode);
      

  5.   

    UPDATE tt set con='hh' where (id+num) in (select (id+num) from dd)这样更简单。