有表aaa,
one
1
2
3要更新为
one
4
5
6只用一个sql语句,要怎么写,不要循环的

解决方案 »

  1.   

    UPDATE aaa SET ONE = ONE + 3
      

  2.   

    不存在这样的关系ONE = ONE + 3one 


    3 要更新为 
    one 

    fg 
    juk 
      

  3.   

    用存储过程或者拼多个update语句。
      

  4.   

    根据什么主KEY更新呢?没规则的..怎么替换??物理存储行号??顺序更新??意思不明确..
      

  5.   

    肯定得有点联系才能替换撒create table #temp
    {
      src varchar(20),
      dst varchar(20)
    }
    insert into #temp
    select '1','a' union
    select '2','fg' union
    select '3','juk'update aaa set aaa.one = #temp.dst
    from #temp inner join aaa
    on #temp.src = aaa.one
      

  6.   

    set table1.one=(select one from table2)