视图的使用
来源:互联网 发布:成志网络 编辑:程序博客网 时间:2024/06/05 12:41
1、
/*
*创建报表视图
*/
create or replace view vm_claim_countcashrptdata as
select
--事业部财务部
(select bus.finasyscode
from t_org_department bus
where bus.status = 1 and bus.id =
((select d1.parentid from t_org_department d1 where d1.status = 1 and d1.finasyscode = (select d.finorgnum
from t_fins_dept2fin d
where d.effect = 1 and d.deptnum = decode(foss.dept, null, v.dept))))) as BUSIORGNUM,
--财务部
(select d.finorgnum
from t_fins_dept2fin d
where d.effect = 1 and d.deptnum = decode(foss.dept, null, v.dept)) as FINORGNUM,
--营业部
decode(foss.dept, null, v.dept) as DEPTNUM,
--(case when foss.dept is null then v.dept else foss.dept end)as dept,
--现金收银金额
nvl(foss.amt, 0) CASHAMT,
--汇款金额
nvl(v.amt, 0) REMITAMT,
--累计收银金额
nvl(rpt.totalcashamt, 0) TOTALCASHAMT,
--累计未汇款
nvl(rpt.totalunremitamt, 0) TOTALUNREMITAMT
from (
--汇总现金缴款数据
select sum(nvl(f.cashamt, 0)) amt,
--营业部
f.depthnum dept
from t_claim_fosscashdata f
group by f.depthnum) foss
full join vm_claim_remittancerecord v on v.dept = foss.dept
left join T_CLAIM_CASHCHECKRPT rpt on rpt.deptnum = decode(foss.dept, null, v.dept)
and rpt.rptdate = trunc(sysdate-2)
WITH READ ONLY ;
2、
0 0
- SQL视图的使用
- 视图的使用
- 使用视图的好处
- 物化视图的使用
- Oracle视图的使用
- Oracle视图的使用
- 视图的使用
- 数据库视图的使用
- 视图的使用
- 物化视图的使用
- MySQL视图的使用
- sql的使用|视图
- oracle视图的使用
- 数据库视图的使用
- Mysql视图的使用
- mysql 视图的使用
- mysql的视图使用
- MySQL视图的使用
- SzNOI c003 中缀表达式转后缀表达式
- Amr and Pins——圆的旋转
- Android开发之网络请求通信专题(二):基于HttpClient的文件上传下载
- bbb u-boot mmc总线初始化分析
- getApplication、getBaseContext、this之间的区别
- 视图的使用
- 还原餐饮的本质:极致产品
- oracle start with connect by
- shell中\cmd的作用
- VELT-0.1.3开发: Makefile
- android数据库操作
- java笔记——多线程下载
- 物化视图的使用
- B树基本操作C实现