不清楚么?
字段 A B C D E ,数据都是字符的。其实无所喂什么类型。。
0 23 4 7 9
1 0 23 0 7
2 4 0 0 0
to 23 0 0 9我希望根据"to"记录的字段值,统计相应"0,1,2"字段值的总和,即如果"to"的B字段>0,则"0,1,2"的B字段求和23+0+4=27,如果"to"的C字段为0,则给个0值。 "to"的E字段>0,则
"0,1.2"的E字段求和9+7+0=16;
最后得到一个象这样的记录:
A B C D E
TT 27 0 0 16可做到么??
字段 A B C D E ,数据都是字符的。其实无所喂什么类型。。
0 23 4 7 9
1 0 23 0 7
2 4 0 0 0
to 23 0 0 9我希望根据"to"记录的字段值,统计相应"0,1,2"字段值的总和,即如果"to"的B字段>0,则"0,1,2"的B字段求和23+0+4=27,如果"to"的C字段为0,则给个0值。 "to"的E字段>0,则
"0,1.2"的E字段求和9+7+0=16;
最后得到一个象这样的记录:
A B C D E
TT 27 0 0 16可做到么??
解决方案 »
- 如何删除oracle中的其中一个数据库
- 100分求Oracle存储过程返回游标的实例
- 有关oracle10g全文索引中world lexer设置的问题
- Oracle中创建表时"超出表空间"system"的空间向量"谁来帮我解决下..
- [求助]有哪位朋友用过FORMDIFF这个工具,请进来看看。。
- 刚学oracle,问几个简单的问题!
- 如何知道oracle数据库中某个表的某个字段的数据被修改了?
- 在表种添加一条数据,另一表中的数值加1,用SQL怎么实现?
- 表中增加index能提高查询效率,此查询是在当where后的条件为index中的column时才能提高效率,还是对所有字段都能提高效率?谁能解释一下
- oracle分批导出问题
- 7500万条数据的检索呀!!!
- 帮帮忙
case when t1.b=0 then 0 when t1.b<>0 then t2.sb end as BB,
case when t1.c=0 then 0 when t1.c<>0 then t2.sc end as CC,
case when t1.d=0 then 0 when t1.d<>0 then t2.sd end as DD,
case when t1.e=0 then 0 when t1.e<>0 then t2.se end as EE
from
(select * from t where a='to') t1,
(select sum(b) as sb,sum(c) as sc,sum(d) as sd,sum(e) as se
from t where a<>'to') t2
/
sum(decode((select C from table_name where a='to'),0,0,C),
sum(decode((select D from table_name where a='to'),0,0,D)
from table_name where a<>'to' group by a