Update row with data from another row in the same table

前端 未结 5 1408
一向
一向 2020-11-27 02:59

I\'ve got a table which looks something like this

ID   |   NAME    |  VALUE  |
----------------------------
 1   |   Test    |  VALUE1 |
 2   |   Test2   |          


        
5条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-11-27 03:23

    UPDATE financialyear
       SET firstsemfrom = dt2.firstsemfrom,
           firstsemto = dt2.firstsemto,
           secondsemfrom = dt2.secondsemfrom,
           secondsemto = dt2.secondsemto
      from financialyear dt2
     WHERE financialyear.financialyearkey = 141
       AND dt2.financialyearkey = 140
    

提交回复
热议问题