OPID ALATEXT
time 2006 09 07 15 43 51
comp NI E LP 2 E1 23
Type E coations
severity E mi
probable E deSignal想转换成
time comp Type severity probable
2006 09 07 15 43 51 NI E LP 2 E1 23 E coations E mi E deSignal请问该怎么办?
time 2006 09 07 15 43 51
comp NI E LP 2 E1 23
Type E coations
severity E mi
probable E deSignal想转换成
time comp Type severity probable
2006 09 07 15 43 51 NI E LP 2 E1 23 E coations E mi E deSignal请问该怎么办?
from
(select decode(OPID,'time',ALATEXT) as time,
...,
decode(probable,'time',ALATEXT) as probable
from tab)
group by time,...,probable之后再嵌掏一层,把count(*)去掉!
decode(OPID,'comp', ALATEXT,null) comp
decode(OPID,'type', ALATEXT,null) type
decode(OPID,'severity', ALATEXT,null) severity
decode(OPID,'probable', ALATEXT,null) probable
from table
group by OPID
select decode(OPID, 'time', select time from table, null) time,
decode(OPID, 'comp', select comp from table, null) comp
decode(OPID, 'type', select type from table, null) type
decode(OPID, 'severity', select severity from table, null) severity
decode(OPID, 'probable', select probable from table, null) probable
from table
group by OPID
select time,...,probable,count(*)
from
(select decode(OPID,'time',ALATEXT) as time,
...,
decode(OPID,'probable',ALATEXT) as probable
from tab)
group by time,...,probable
select decode(OPID,'time',ALATEXT) as time,
...,
decode(OPID,'probable',ALATEXT) as probable
from tab
time comp Type severity probable
2006 09 07 15 43 51
NI E LP 2 E1 23
E coations
E mi
E deSignaltime 2006 09 07 15 43 51
comp NI E LP 2 E1 23
Type E coations
severity E mi
probable E deSignal
我的表里数据是这样的:
OPID ALATEXT
time 2006 09 07 15 43 51
comp NI E LP 2 E1 23
Type E coations
severity E mi
probable E deSignal
time 2006 09 08 10 40 50
comp NI E LP 2 E1 23
Type E coationsss
severity E mirrr
probable E deSignalwww想转换成
time comp Type severity probable
2006 09 07 15 43 51 NI E LP 2 E1 23 E coations E mi E deSignal
decode(OPID, 'comp', select ALATEXT from table where OPID = 'comp', null) comp
decode(OPID, 'type', select ALATEXT from table where OPID = 'type', null) type
decode(OPID, 'severity', select ALATEXT from table where OPID = 'severity', null) severity
decode(OPID, 'probable', select ALATEXT from table where OPID = 'probable', null) probable
from table
group by OPID