SQL set values of one column equal to values of another column in the same table

前端 未结 5 2006
[愿得一人]
[愿得一人] 2021-02-02 05:11

I have a table with two DATETIME columns.

One of them is never NULL, but one of them is sometimes NULL.

I need to write a query which will set all the NULL rows

5条回答
  •  醉酒成梦
    2021-02-02 05:26

    Sounds like you're working in just one table so something like this:

    update your_table
    set B = A
    where B is null
    

提交回复
热议问题