更新表内字段,问号的的地方要从另一张表中得到。。表bs  k    e
1  2009 2009
2  2008 2009更新表a
Update a Set a.s=?Where a.k>=? And a.e<=?
请大家帮忙看看怎么实现。。

解决方案 »

  1.   

    update a set a.s=(select col1 from t where t.id=a.s and a.k>=.. and a.e<=..),
      s.e=(select col2 from tt where tt.id=a.s and a.e<= and a.k>=)
      

  2.   

    有一个id,要通过id更新a表中id,条件就是s,k,e这几天字段
      

  3.   

    好想要循环了,因为要更新a表中的很多记录,a表
    id, s ,k   ,e
    1 , 0 ,2009,2009
    2 , 0 ,2008,2009b表
    id, s ,k   ,e
    1 , 1 ,2009,2009
    2 , 2 ,2008,2009就是把b表中的s字段更新到a表中的s。
      

  4.   

    你是更新ID?那 s+k+e是唯一吗?
      

  5.   

    这样的话,如果id对应直接
    update a set s=(select s from b where id=a.id)不就好了
      

  6.   

    呵呵,你需求描述清楚的话,肯定可以一个sql完成的
      

  7.   

    2个表之间更新用merge比用子查询快