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

前端 未结 5 2004
[愿得一人]
[愿得一人] 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:13

    Here is sample code that might help you coping Column A to Column B:

    UPDATE YourTable
    SET ColumnB = ColumnA
    WHERE
    ColumnB IS NULL
    AND ColumnA IS NOT NULL;
    

提交回复
热议问题