How to Update table column in SQL SERVER DB based on condition -


i have table following information:

id         value_n1        date_n1     value_n4      date_n4 1           null          2017-05-31    0.236        2017-02-28 2           null          2017-05-31    0.589        2017-02-28 3           null          2017-08-30    0.898        2017-08-30 4           null          2017-11-30    0.789        2017-11-30 

i want update value_n1 column values value_n4 date_n1 equal date_n4

i have tried use following query going it:

update tablename set value_n1 = (select value_n4 tblename date_n1 = date_n4) 

of-cause query doesn't work because returns more 1 value. how can achieved?

your logic setting new value value_n1 on right track, restrictions records update should appear in where clause.

update tablename set value_n1 = value_n4 date_n1 = date_n4 

Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -