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 ...
随机推荐
- ThinkPHP框架的网站url重写
nginx location / { root /var/www; index index.html index.htm index.php; if (!-e $request_filename) { ...
- Educational Codeforces Round 1(D. Igor In the Museum) (BFS+离线访问)
题目链接:http://codeforces.com/problemset/problem/598/D 题意是 给你一张行为n宽为m的图 k个询问点 ,求每个寻问点所在的封闭的一个上下左右连接的块所能 ...
- CodeForces 705B Spider Man (水题)
题意:给定 n 个数,表示不同的环,然后把环拆成全是1,每次只能拆成两个,问你有多少次. 析:也不难,反正都要变成1,所以把所有的数都减1,再求和即可. 代码如下: #pragma comment(l ...
- Sql CLR
using System;using System.Data;using System.Data.SqlClient;using System.Data.SqlTypes;using Microsof ...
- heidsoft logo
- copy and Xcopy 复制文件到另一地址
1. copy不能复制文件夹下的文件,而Xcopy可以. 2. Xcopy不能连接文件,而copy可以连接文件 eg : 将A盘中的A.TXT和B.TXT文件连接起来,连接后的文件名为C.TXT ...
- iOS开发——UI篇&下拉弹出列表选择项效果
下拉弹出列表选择项效果 右边菜单中的按键,点击弹出一个列表可选择,选择其中一个,响应相应的事件并把文字显示在右边的菜单上:弹出下拉效果使用LMDropdownView插件,可以用POD进行加载pod ...
- [Effective C++ --030]透彻了解inlining的里里外外
引言 inline函数 在函数声明或定义中函数返回类型前加上关键字inline即把min()指定为内联. inline函数对编译器而言必须是可见的,以便它能够在调用点内展开该函数.与非inline函 ...
- Jordan Lecture Note-1: Introduction
Jordan Lecture Note-1: Introduction 第一部分要整理的是Jordan的讲义,这份讲义是我刚进实验室时我们老师给我的第一个任务,要求我把讲义上的知识扩充出去,然后每周都 ...
- textarea 中的换行符问题
下面是我对这个问题的解决过程,最后算是完全搞懂了,真是阴沟里险些翻船 1.必须知道textarea中的换行符是 \n (个人检测发现按回车键是\n,好像在linux下是\r\n) 2.用nl2br之 ...