How to select the comparison of two columns as one column in Oracle

后端 未结 3 2182
滥情空心
滥情空心 2020-12-14 00:35

I cannot figure out how to add a column to my SELECT query indicating whether two columns contain the same data in Oracle.

I would like to write a query like:

<
3条回答
  •  萌比男神i
    2020-12-14 00:56

    If you want to consider null values equality too, try the following

    select column1, column2, 
       case
          when column1 is NULL and column2 is NULL then 'true'  
          when column1=column2 then 'true' 
          else 'false' 
       end 
    from table;
    

提交回复
热议问题