Select a column if other column is null

后端 未结 7 756
庸人自扰
庸人自扰 2020-12-08 13:14

I need to select a field called ProgramID from a table and if the ProgramID is NULL then I need to select the value in the InterimProgramID from the same table and alias it

7条回答
  •  长情又很酷
    2020-12-08 13:38

    There is also:

    Select NVL(Column_A, Column_B) From 'schema'.'table_name'
    

    The NVL( ) function is available in Oracle, and not in MySQL or SQL Server. This function is used to replace NULL value with another value. It is similar to the IFNULL Function in MySQL and the ISNULL Function in SQL Server.

    https://www.1keydata.com/sql/sql-nvl.html

提交回复
热议问题