SQL练习—4
来源:互联网 发布:js或且非符号 编辑:程序博客网 时间:2024/06/07 10:33
select temp.*,
(select sum(pv)
from (select invest.id,
(select sum(trunc(f.debt_proportion * l.amount_spare, 2))
from ac_t_ledger_loan@dl.core l,
ac_t_ledger_finance@dl.core f
where l.id = f.loan_id
and f.acct_status in (1, 3, 4)
and l.acct_status in (1, 3, 4)
and f.ledger_id in
(select t.id
from ac_t_ledger@dl.core t
where t.account in
(select t1.acc_id
from ft_t_invest_info t1
where t1.id = invest.id))) as pv
from ft_t_invest_info invest
where customer_id = 111)) as 总PV
from (select invest.id,
(select t.cr_customer_number
from crm_customer@dl.crm t
where t.id = invest.customer_id) || '-' ||
invest.lending_no as 出借编号,
(select NODE_NAME
from FT_T_FLOW_DEF c
where invest.flow_id = c.node_code) as 流程ID,
(select data_name
from sys_t_dictionary b
where invest.product_type = b.data_code) as 理财产品,
(select sum(trunc(f.debt_proportion * l.amount_spare, 2))
from ac_t_ledger_loan@dl.core l,
ac_t_ledger_finance@dl.core f
where l.id = f.loan_id
and f.acct_status in (1, 3, 4)
and l.acct_status in (1, 3, 4)
and f.ledger_id in
(select t.id
from ac_t_ledger@dl.core t
where t.account in
(select t1.acc_id
from ft_t_invest_info t1
where t1.id = invest.id))) as pv,
invest.invest_amt as 投资金额
from ft_t_invest_info invest
where customer_id = 111) temp;
(select sum(pv)
from (select invest.id,
(select sum(trunc(f.debt_proportion * l.amount_spare, 2))
from ac_t_ledger_loan@dl.core l,
ac_t_ledger_finance@dl.core f
where l.id = f.loan_id
and f.acct_status in (1, 3, 4)
and l.acct_status in (1, 3, 4)
and f.ledger_id in
(select t.id
from ac_t_ledger@dl.core t
where t.account in
(select t1.acc_id
from ft_t_invest_info t1
where t1.id = invest.id))) as pv
from ft_t_invest_info invest
where customer_id = 111)) as 总PV
from (select invest.id,
(select t.cr_customer_number
from crm_customer@dl.crm t
where t.id = invest.customer_id) || '-' ||
invest.lending_no as 出借编号,
(select NODE_NAME
from FT_T_FLOW_DEF c
where invest.flow_id = c.node_code) as 流程ID,
(select data_name
from sys_t_dictionary b
where invest.product_type = b.data_code) as 理财产品,
(select sum(trunc(f.debt_proportion * l.amount_spare, 2))
from ac_t_ledger_loan@dl.core l,
ac_t_ledger_finance@dl.core f
where l.id = f.loan_id
and f.acct_status in (1, 3, 4)
and l.acct_status in (1, 3, 4)
and f.ledger_id in
(select t.id
from ac_t_ledger@dl.core t
where t.account in
(select t1.acc_id
from ft_t_invest_info t1
where t1.id = invest.id))) as pv,
invest.invest_amt as 投资金额
from ft_t_invest_info invest
where customer_id = 111) temp;
- SQL练习—4
- SQL练习4
- sql上机练习4
- SQL练习—2
- sql练习
- SQL练习
- sql练习
- sql练习
- sql练习
- sql 练习
- SQL练习
- sql练习
- sql练习
- sql 练习
- sql练习
- SQL 练习
- sql练习
- sql练习
- Jquery千百种选择器
- Xen中的工具libxc
- jQuery基础教程第九章学习
- SQL按照日、周、月、年统计数据
- asp.net中的web.config文件通用版本,免出现httpRuntime错误
- SQL练习—4
- 单例模式
- C语言函数集(十九)
- 【Linux】 Linux目录结构(CentOS)
- ie下z-index
- Jquery操作select
- BGD work process used by SAPMSSY2 RSBTCRTE
- 并行启动应用程序从而加速 Linux 的引导
- oracle 表空间、临时表空间、创建用户、导入数据、导出数据