select 编号 as 编号, case 状态 when '新增' then '1' when '撤销' then 'null' when '故障' then 'null' end as 新增, case 状态 when '新增' then 'null' when '撤销' then '1' when '故障' then 'null' end as 撤销, case 状态 when '新增' then 'null' when '撤销' then 'null' when '故障' then '1' end as 故障 from test01
或者使用decodeselect 编号 as 编号, decode(状态,'新增','1','撤销','null','故障','null') as 新增, decode(状态,'新增','null','撤销','1','故障','null') as 撤销, decode(状态,'新增','null','撤销','null','故障','1') as 故障 from test01
case 状态 when '新增' then '1' when '撤销' then 'null' when '故障' then 'null' end as 新增,
case 状态 when '新增' then 'null' when '撤销' then '1' when '故障' then 'null' end as 撤销,
case 状态 when '新增' then 'null' when '撤销' then 'null' when '故障' then '1' end as 故障
from test01
decode(状态,'新增','1','撤销','null','故障','null') as 新增,
decode(状态,'新增','null','撤销','1','故障','null') as 撤销,
decode(状态,'新增','null','撤销','null','故障','1') as 故障
from test01