select count(case when t.c_ltlb='60' and t.c_lthxsdyjb in('103','401','303')then 1 end)as a1,
count(case when t.c_ltlb='60' and t.c_lthxsdyjb in('104','402','304')then 1 end)as a2,
count(case when t.c_ltlb='60' and t.c_lthxsdyjb in('105','403','305')then 1 end)as a3,
count(case when t.c_ltlb='60' and t.c_lthxsdyjb in('106','404','306')then 1 end)as a4,
count(case when t.c_ltlb='60' and t.c_lthxsdyjb in('107','405','307')then 1 end)as a5,
count(case when t.c_ltlb='60' and t.c_lthxsdyjb in('108','406','308')then 1 end)as a6, a1+a2+a3+a4+a5+a6
from (select sn,c_ltlb,c_lthxsdyjb from t_ryltxx where c_ltlb in
('60','61','74')) t;
为什么提示a6无效呢,oracle不支持:a1+a2+a3+a4+a5+a6这样写吗?
这样看看。
count(case when t.c_ltlb='60' and t.c_lthxsdyjb in('104','402','304')then 1 end)as a2,
count(case when t.c_ltlb='60' and t.c_lthxsdyjb in('105','403','305')then 1 end)as a3,
count(case when t.c_ltlb='60' and t.c_lthxsdyjb in('106','404','306')then 1 end)as a4,
count(case when t.c_ltlb='60' and t.c_lthxsdyjb in('107','405','307')then 1 end)as a5,
count(case when t.c_ltlb='60' and t.c_lthxsdyjb in('108','406','308')then 1 end)as a6, a1+a2+a3+a4+a5+a6
from (select sn,c_ltlb,c_lthxsdyjb from t_ryltxx where c_ltlb in
('60','61','74')) t;
为什么提示a6无效呢,oracle不支持:a1+a2+a3+a4+a5+a6这样写吗?
这样看看。
解决方案 »
- 部分数据库备份可以在数据库关闭时进行备份 指的是数据库脱机备份吗?
- ORA-00932:inconsistent datatypes: expected NUMBER got LONG
- !!过程那里有错那里有错???
- 谁能说一说oracle的好处???对比SqlServer
- 借个技术社区的宝地小小声地问一下Oracle薪水问题。。。希望大家帮帮忙
- 因目标主机或对象不存在,连接失败!!有解么?
- 关于oracle安装时的一个恼火的问题!!!!!!!!!!!
- 如何替换字符的问题
- 创建新表时,表空间和方案是什么意思?
- 下班前的急救!江湖再次告急--求SQL语句!
- 初学oracle者:几个小问题,请教了。。
- 在oracle动态游标里sql语句的长度有限制吗?
count(case when t.c_ltlb='60' and t.c_lthxsdyjb in('104','402','304')then 1 end)as a2,
count(case when t.c_ltlb='60' and t.c_lthxsdyjb in('105','403','305')then 1 end)as a3,
count(case when t.c_ltlb='60' and t.c_lthxsdyjb in('106','404','306')then 1 end)as a4,
count(case when t.c_ltlb='60' and t.c_lthxsdyjb in('107','405','307')then 1 end)as a5,
count(case when t.c_ltlb='60' and t.c_lthxsdyjb in('108','406','308')then 1 end)as a6, a1+a2+a3+a4+a5+a6
from (select count(case when t.c_ltlb='60' and t.c_lthxsdyjb in('103','401','303')then 1 end)as a1,
count(case when t.c_ltlb='60' and t.c_lthxsdyjb in('104','402','304')then 1 end)as a2,
count(case when t.c_ltlb='60' and t.c_lthxsdyjb in('105','403','305')then 1 end)as a3,
count(case when t.c_ltlb='60' and t.c_lthxsdyjb in('106','404','306')then 1 end)as a4,
count(case when t.c_ltlb='60' and t.c_lthxsdyjb in('107','405','307')then 1 end)as a5,
count(case when t.c_ltlb='60' and t.c_lthxsdyjb in('108','406','308')then 1 end)as a6)
,tb.a1+tb.a2+tb.a3+tb.a4+tb.a5+tb.a6
from
(
select count(case when t.c_ltlb='60' and t.c_lthxsdyjb in('103','401','303')then 1 end)as a1,
count(case when t.c_ltlb='60' and t.c_lthxsdyjb in('104','402','304')then 1 end)as a2,
count(case when t.c_ltlb='60' and t.c_lthxsdyjb in('105','403','305')then 1 end)as a3,
count(case when t.c_ltlb='60' and t.c_lthxsdyjb in('106','404','306')then 1 end)as a4,
count(case when t.c_ltlb='60' and t.c_lthxsdyjb in('107','405','307')then 1 end)as a5,
count(case when t.c_ltlb='60' and t.c_lthxsdyjb in('108','406','308')then 1 end)as a6,a1+a2+a3+a4+a5+a6
from (select sn,c_ltlb,c_lthxsdyjb from t_ryltxx where c_ltlb in
('60','61','74')) t ) tb