union on
UNION 操作符用于合并两个或多个 SELECT 语句的结果集。 请注意,UNION 内部的 SELECT 语句必须拥有相同数量的列。列也必须拥有相似的数据类型。同时,每条 SELECT 语句中的列的顺序必须相同。
create or replace view fbm_consignbank_view as
select a.pk_group ,a.pk_org,a.pk_billtypecode as pk_billtype,a.holderacc as PK_ACCOUNT,a.vbillno,substr(a.dcollectiondate,0,10) as TALLYDATE,a.pk_consignbank as pk_bill,
a.fbmplanitem as PK_PLANITEM,a.olcmoney as recmoney,'' as paymoney,a.def1 as pk_inout,a.def2 as PK_CASHFLOW,a.dr,'' as VDEF1,'' as VDEF2,
a.note,'' as pk_dept
from fbm_consignbank a
where a.dr=0 and a.vbillstatus=1 and a.pk_billtypecode='36H5';
commit;
create or replace view fbm_discount_view as
select pk_group,pk_org,pk_billtype,PK_ACCOUNT,vbillno,TALLYDATE,pk_bill,PK_PLANITEM,recmoney,paymoney,pk_inout,PK_CASHFLOW,dr,VDEF1,VDEF2,note,pk_dept from
(select a.pk_group ,a.pk_org,a.pk_billtypecode as PK_BILLTYPE,a.discount_account as PK_ACCOUNT,a.vbillno,substr(a.ddiscountdate,0,10) as TALLYDATE,a.pk_discount as pk_bill,
a.fbmplanitem as PK_PLANITEM,to_char(a.olcmoney) as recmoney,'' as paymoney,a.def7 as pk_inout,a.def2 as PK_CASHFLOW,a.dr,'' as VDEF1,'' as VDEF2,
a.note,'' as pk_dept,a.vbillstatus from fbm_discount a
union all
select a.pk_group ,a.pk_org,a.pk_billtypecode as PK_BILLTYPE,a.discount_account as PK_ACCOUNT,a.vbillno,substr(a.ddiscountdate,0,10) as TALLYDATE,a.pk_discount as pk_bill,
a.interestplanitem as PK_PLANITEM,'' as recmoney,to_char(a.discountinterest) as paymoney,a.def5 as pk_inout,a.def6 as PK_CASHFLOW,a.dr,'' as VDEF1,'' as VDEF2,
a.note,'' as pk_dept,a.vbillstatus from fbm_discount a)b
where dr=0 and vbillstatus=1 and pk_billtype='36H7';
commit;
create or replace view hz_cmp_bankacdetail_all_view14 as
select "TALLYDATE","DR","PAYMONEY","RECMONEY","PK_ACCOUNT","PK_ORG","PK_PLANITEM","PK_CASHFLOW","PK_INOUT","VDEF1","VDEF2","PK_GROUP","PK_BILL","PK_BILLTYPE","VBILLNO","NOTE","PK_DEPT" from hz_cmp_bankaccdetail_bas_view2 where tallydate>='2015-01-01'
Union all
select "TALLYDATE","DR","PAYMONEY","RECMONEY","PK_ACCOUNT","PK_ORG","PK_PLANITEM","PK_CASHFLOW","PK_INOUT","VDEF1","VDEF2","PK_GROUP","PK_BILL","PK_BILLTYPE","VBILLNO","NOTE","PK_DEPT" from hz_ap_payitem_view where tallydate>='2015-01-01'
Union all
select "TALLYDATE","DR","PAYMONEY","RECMONEY","PK_ACCOUNT","PK_ORG","PK_PLANITEM","PK_CASHFLOW","PK_INOUT","VDEF1","VDEF2","PK_GROUP","PK_BILL","PK_BILLTYPE","VBILLNO","NOTE","PK_DEPT" from hz_ar_gatheritem_view where tallydate>='2015-01-01'
Union all
select "TALLYDATE","DR","PAYMONEY","RECMONEY","PK_ACCOUNT","PK_ORG","PK_PLANITEM","PK_CASHFLOW","PK_INOUT","VDEF1","VDEF2","PK_GROUP","PK_BILL","PK_BILLTYPE","VBILLNO","NOTE","PK_DEPT" from hz_cmp_paybilldetail_view where tallydate>='2015-01-01'
Union all
select "TALLYDATE","DR","PAYMONEY","RECMONEY","PK_ACCOUNT","PK_ORG","PK_PLANITEM","PK_CASHFLOW","PK_INOUT","VDEF1","VDEF2","PK_GROUP","PK_BILL","PK_BILLTYPE","VBILLNO","NOTE","PK_DEPT" from hz_cmp_recbilldetail_view where tallydate>='2015-01-01'
union all
select "TALLYDATE","DR","PAYMONEY","RECMONEY","PK_ACCOUNT","PK_ORG","PK_PLANITEM","PK_CASHFLOW","PK_INOUT","VDEF1","VDEF2","PK_GROUP","PK_BILL","PK_BILLTYPE","VBILLNO","NOTE","PK_DEPT" from hz_fbm_accept_view where tallydate>='2015-01-01'
union all
select "TALLYDATE","DR","PAYMONEY","RECMONEY","PK_ACCOUNT","PK_ORG","PK_PLANITEM","PK_CASHFLOW","PK_INOUT","VDEF1","VDEF2","PK_GROUP","PK_BILL","PK_BILLTYPE","VBILLNO","NOTE","PK_DEPT" from hz_sf_fundtransfer_view where tallydate>='2015-01-01'
union all
select "TALLYDATE","DR",to_number("PAYMONEY"),to_number("RECMONEY"),"PK_ACCOUNT","PK_ORG","PK_PLANITEM","PK_CASHFLOW","PK_INOUT","VDEF1","VDEF2","PK_GROUP","PK_BILL","PK_BILLTYPE","VBILLNO","NOTE","PK_DEPT" from fbm_discount_view where tallydate>='2015-01-01'
union all
select "TALLYDATE","DR",to_number("PAYMONEY"),to_number("RECMONEY"),"PK_ACCOUNT","PK_ORG","PK_PLANITEM","PK_CASHFLOW","PK_INOUT","VDEF1","VDEF2","PK_GROUP","PK_BILL","PK_BILLTYPE","VBILLNO","NOTE","PK_DEPT" from fbm_consignbank_view where tallydate>='2015-01-01';
union on的更多相关文章
- SQL Server-聚焦UNIOL ALL/UNION查询(二十三)
前言 本节我们来看看有关查询中UNION和UNION ALL的问题,简短的内容,深入的理解,Always to review the basics. 初探UNION和UNION ALL 首先我们过一遍 ...
- SQL 提示介绍 hash/merge/concat union
查询提示一直是个很有争议的东西,因为他影响了sql server 自己选择执行计划.很多人在问是否应该使用查询提示的时候一般会被告知慎用或不要使用...但是个人认为善用提示在不修改语句的条件下,是常用 ...
- LINQ to SQL语句(8)之Concat/Union/Intersect/Except
适用场景:对两个集合的处理,例如追加.合并.取相同项.相交项等等. Concat(连接) 说明:连接不同的集合,不会自动过滤相同项:延迟. 1.简单形式: var q = ( from c in db ...
- SQLServer-----Union,Union All的使用方法
转载: http://blog.csdn.net/kiqinie/article/details/8132485 select a.Name from Material as a union sele ...
- 假如 UNION ALL 里面的子句 有 JOIN ,那个执行更快呢
比如: select id, name from table1 where name = 'x' union all select id, name from table2 where name = ...
- sql union和union all的用法及效率
UNION指令的目的是将两个SQL语句的结果合并起来.从这个角度来看, 我们会产生这样的感觉,UNION跟JOIN似乎有些许类似,因为这两个指令都可以由多个表格中撷取资料. UNION的一个限制是两个 ...
- 【oracle】union、union all、intersect、minus 的用法及区别
一.union与union all 首先建两个view create or replace view test_view_1 as as c from dual union as c from dua ...
- sql with as union all
WITH RPL (FId,Fname,Forder) AS ( SELECT ment.deptno,ment.deptname,ment.orderno FROM JTERP..fg_depart ...
- Oracle 中 union 和union all 的简单使用说明
1.刚刚工作不久,经常接触oracle,但是对oracle很多东西都不是很熟.今天我们来了解一下union和union all的简单使用说明.Union(union all): 指令的目的是将两个 S ...
- LINQ系列:LINQ to SQL Concat/Union
1. Concat 单列Concat var expr = (from p in context.Products select p.ProductName) .Concat( from c in c ...
随机推荐
- Lua学习笔记(二):基本语法
Lua学习指南:http://www.lua.org/manual/ 首先我们要明确的一点是:在Lua中,除了关键字外一切都是变量. Lua关键字 可以查看这个地址:http://www.lua.or ...
- map的正确删除方式
遍历删除map元素的正确方式是 for(itor = maptemplate.begin; itor != maptemplate.end(); ) { if(neederase) ...
- 连接查询中on and和on where的区别
一.区别 1. and条件是在生成临时表时使用的条件,它不管and中的条件是否为真,都会返回左(或者右)边表中的记录. 2.where条件是在临时表生成好后,再对临时表进行过滤的条件.这时已经没有le ...
- Oracle数据库的版本变迁功能对比
Oracle数据库自发布至今,也经历了一个从不稳定到稳定,从功能简单至强大的过程.从第二版开始,Oracle的每一次版本变迁,都具有里程碑意义. 1979年的夏季,RSI(Oracle公司的前身,Re ...
- Cocos2d-x——CocosBuilder官方帮助文档翻译3 动画
Working with Animations 动画 You can use CocosBuilder for creating character animations, animating com ...
- iOS UIButton EdgeInsets
说一下系统的button,image 和 title的位置关系 默认image 和 title的位置关系: 随便画了草图,有点丑,不过不妨碍理解: 第一种:在button上只设置文字,这个时候,but ...
- flash的dragonbone插件导入cocos2d的注意事项
一:Flash版本号应该为CS 6.0,低版本号不提供支持 二:新建flash项目的时候应该选择ActionScript3.0 三:动画中仅仅有两种元素,一个是"元件",还有一个是 ...
- 发现一个挺好用的adb logcat工具
其实是个Notepad++插件 直接贴地址: [http://sourceforge.net/projects/androidlogger/] ============================ ...
- Codeforces Round #115 A. Robot Bicorn Attack 暴力
A. Robot Bicorn Attack Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/17 ...
- [GIF] GIF Loop Coder Single Mode
We'll take a look at Single Mode animations and strategies for making this type of animation smoothl ...