在线等, oracle 查询 两个字段,第一个和第二个字段不为空时,就用第二个字段的值, 否则用第一个字段的

急 急 急 急 !!!!跪求 实现的sql语句
2025-03-09 12:33:35
推荐回答(2个)
回答1:

select
(case when 第二字段 is not null then 第二字段 else 第一字段 end) 字段名 from table_name;

回答2:

使用decode函数,或者case when 或者if then就可以了!