create or replace view laview as
select
sum(decode(opid,'time D',1,0))time,
sum(decode(opid,'compId',1,0))compid,
sum(decode(opid,'alarmType',1,0))alarmtype,
sum(decode(opid,'severity',1,0))serverity,
sum(decode(opid,'probableCause',1,0))probaleC
from table;
得出的值为什么是0 ?
table里的数据
OPID ALATEXT
---------------------------------------------------------
time D 2006 09 07 15 43 51
compId NI EM HBJMPP04 LP 2 E1 23
alarmType E communications
severity E minor
probableCause E degradedSignal
select
sum(decode(opid,'time D',1,0))time,
sum(decode(opid,'compId',1,0))compid,
sum(decode(opid,'alarmType',1,0))alarmtype,
sum(decode(opid,'severity',1,0))serverity,
sum(decode(opid,'probableCause',1,0))probaleC
from table;
得出的值为什么是0 ?
table里的数据
OPID ALATEXT
---------------------------------------------------------
time D 2006 09 07 15 43 51
compId NI EM HBJMPP04 LP 2 E1 23
alarmType E communications
severity E minor
probableCause E degradedSignal
解决方案 »
- Oracle 9i求问
- 求助各位大虾,本科毕业设计做Oracle数据库方面的可以做什么?
- 求助关于日期函数的固定问题
- href
- 在PLSQL Developer中用关联查询,找不到想要的资料,请高人帮忙看看
- Oracle的Enterprise Manager Console 连不上
- 关于Sequence的用法!!
- 在线求助一源代码:在Oracle Database环境下,用P/LSQL写数据查询中的交叉表SQL语句.
- 又一个asp。net连接oracle9i的问题
- MERGE INTO 优化
- 我在学习proc编程,可是出现了问题:请高手帮忙。谢谢
- 50分:为什么我打不开oracle的企业管理器(Enterprise Manager)?来者有分
select * from table where OPID ='time D'试试
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
select substr(max(sys_connect_by_path(userid,',')),2) A1
from (select userid,rownum rn from zzb_userposthis)
start with rn = 1
connect by rn = prior rn+1
select
sum(decode(opid,'time D',ALATEXT,' '))time,
sum(decode(opid,'compId',ALATEXT,' '))compid,
sum(decode(opid,'alarmType',ALATEXT,' '))alarmtype,
sum(decode(opid,'severity',ALATEXT,' '))serverity,
sum(decode(opid,'probableCause',ALATEXT,' '))probaleC
from table;
/
(select ALATEXT from table where poid='time D') time,
(select ALATEXT from table where opid='compId') compid,
(select ALATEXT from table where opid='alarmType') alarmtype,
(select ALATEXT from table where opid='severity') serverity,
(select ALATEXT from table where opid='probableCause') probaleC
from dual
http://community.csdn.net/Expert/topic/5000/5000557.xml?temp=.5728113