我现在有2张表test01编号 状态
1 新增
2 撤销
3 故障
4 新增 用一个 sql语句 出现的 情况 是
编号 新增 撤销 故障
1 1 null null
2 null 1 null
3 null null 1
4 1 null null我 在线等待 ,谢谢
1 新增
2 撤销
3 故障
4 新增 用一个 sql语句 出现的 情况 是
编号 新增 撤销 故障
1 1 null null
2 null 1 null
3 null null 1
4 1 null null我 在线等待 ,谢谢
1 新增
2 撤销
3 故障
4 新增 用一个 sql语句 出现的 情况 是
编号 新增 撤销 故障
1 1 null null
2 null 1 null
3 null null 1
4 1 null null我 在线等待 ,谢谢
编号,
decode(状态,'新增',1,null) 新增,
decode(状态,'撤销',1,null) 撤销,
decode(状态,'故障',1,null) 故障
from test01
编号,
decode(状态,'新增',1,'') ,
decode(状态,'撤销',1,'') ,
decode(状态,'故障',1,'')
from test01
select
编号 "编号",
(case when 状态 = '新增' then 1 else null end) "新增",
(case when 状态 = '撤销' then 1 else null end) "撤销",
(case when 状态 = '故障' then 1 else null end) "故障",
from test01