select nvl(xxx),sum(a) from xx gourp by ?
xxx是一个嵌套查询
(select nvl(NVL(to_char(approval_amount),(select to_char(num_field33)||'(前期费用)' from pims.o_list_project where id=s.pro_id and if_pstype='1')),0) from pims.o_list_project_sub_review where mainid=s.pro_id)
怎么group by
select id,(select nvl(NVL(to_char(approval_amount),(select to_char(num_field33)||'(前期费用)' from pims.o_list_project where id=s.pro_id and if_pstype='1')),0) from pims.o_list_project_sub_review where mainid=s.pro_id)pftze,sum(SJ_M_TZEXJ) from R_PROPLAN_EXCUTE_SUB s group by id,(select nvl(NVL(to_char(approval_amount),(select to_char(num_field33)||'(前期费用)' from pims.o_list_project where id=s.pro_id and if_pstype='1')),0) from pims.o_list_project_sub_review where mainid=s.pro_id)
ORA-22818:subquery expressions not allowed here
意思是不能嵌套吗 有解决办法?
xxx是一个嵌套查询
(select nvl(NVL(to_char(approval_amount),(select to_char(num_field33)||'(前期费用)' from pims.o_list_project where id=s.pro_id and if_pstype='1')),0) from pims.o_list_project_sub_review where mainid=s.pro_id)
怎么group by
select id,(select nvl(NVL(to_char(approval_amount),(select to_char(num_field33)||'(前期费用)' from pims.o_list_project where id=s.pro_id and if_pstype='1')),0) from pims.o_list_project_sub_review where mainid=s.pro_id)pftze,sum(SJ_M_TZEXJ) from R_PROPLAN_EXCUTE_SUB s group by id,(select nvl(NVL(to_char(approval_amount),(select to_char(num_field33)||'(前期费用)' from pims.o_list_project where id=s.pro_id and if_pstype='1')),0) from pims.o_list_project_sub_review where mainid=s.pro_id)
ORA-22818:subquery expressions not allowed here
意思是不能嵌套吗 有解决办法?
解决方案 »
- sql语句中的‘N' 'U'是什么意思?
- 为什么我以conn / as sysdba连接,它说我没权限。非要conn sys/oracle as sysdba才可以连接呢?
- ORA-00911錯誤,哪裡錯了,看了SQL文
- Oracle如何把表数据转存
- 简单视图的小问题
- temp段怎么才能减小?请各位高手帮个忙.
- 100分求Oracle分頁排序的例子﹗﹗﹗
- 小白求大神指点ORACLE错误ORA-02261
- dmp文件导入oracle数据库时导入到一半时就停了,然后报这些错误,新手不太懂这个
- 关于学习大数据、数据库开发的学习规划。
- ORA-12154: TNS: 无法解析指定的连接标识符
- oracle10g更换11g后效率慢的原因请教
单独执行时能过的
主要想要解决的是嵌套查询和sum结合 怎么分组 不能用nvl那段作为分组条件 他的别名pftze也不行
单独执行时能过的
主要想要解决的是嵌套查询和sum结合 怎么分组 不能用nvl那段作为分组条件 他的别名pftze也不行
select id,
coalesce(to_char(b.approval_amount),to_char(a.num_field33)||'(前期费用)',0) pftze,
sum(SJ_M_TZEXJ)
from R_PROPLAN_EXCUTE_SUB s ,
pims.o_list_project a ,
pims.o_list_project_sub_review b
where b.mainid=s.pro_id
and a.id=s.pro_id
and a.if_pstype='1'
group by id,
coalesce(to_char(b.approval_amount),to_char(a.num_field33)||'(前期费用)',0)
;你试试这个,给你改了一下