-----用户解锁
select * from wfuser for update
-----------------
-----修改金额
select * from bp_account where acntidx = 'YC0003' for update

select * from bp_account_balance where acntidx = 'YC0003' for update

---==========================================================================================
-------------------零售扣款 A和B比对

select t2.contract_no,t2.pay_amt,t2.pay_name,t2.rec_account_no,t2.pay_acc from
(select a.contract_no,a.pay_amt,a.pay_name,a.rec_account_no,a.pay_acc from bi_retail_dd a where a.create_time > date '2017-01-05'
minus
select b.contract_no,b.pay_amt,b.pay_name,b.rec_account_no,b.pay_acc from bi_retail_dd@DBLINK b
where b.create_time > date '2017-01-03' and b.create_time < date '2017-01-04') t2;

-------------------零售扣款 B和A比对

select t2.contract_no,t2.pay_amt,t2.pay_name,t2.rec_account_no,t2.pay_acc from
(select a.contract_no,a.pay_amt,a.pay_name,a.rec_account_no,a.pay_acc from bi_retail_dd@DBLINK a
where a.create_time > date '2017-01-03'and a.create_time < date '2017-01-04'
minus
select b.contract_no,b.pay_amt,b.pay_name,b.rec_account_no,b.pay_acc from bi_retail_dd b
where b.create_time > date '2017-01-04' ) t2;

---------------------
select * from bi_retail_dd where contract_no = 'PA20150500006' and create_time > date '2017-01-04';
select * from bi_retail_dd@DBLINK where contract_no = 'PA20150500006' and create_time > date '2017-01-03' and create_time < date '2017-01-04';

----------------------按照时间查询C和D的全部数据-----

select * from bi_retail_dd@DBLINK where create_time > date '2017-01-03' and create_time < date '2017-01-04' order by tid desc;
select * from bi_retail_dd where create_time > date '2017-01-05' order by tid desc;

----------------------------------------------------------------------------------------------------------------------------------------------------
----------------------零售放款 D和C比对

select t2.contract_no,t2.pay_account_no,t2.rec_dept_name,t2.pay_amt,t2.rec_dept_acc from
(select a.contract_no,a.pay_account_no,a.rec_dept_name,a.pay_amt,a.rec_dept_acc from bi_retail_dc a where a.create_time > date '2017-01-04'
minus
select b.contract_no,b.pay_account_no,b.rec_dept_name,b.pay_amt,b.rec_dept_acc from bi_retail_dc@DBLINK b where b.create_time > date '2017-01-03' and b.create_time < date '2017-01-04') t2;

----------------------零售放款 E和F比对

select t2.contract_no,t2.pay_account_no,t2.rec_dept_name,t2.pay_amt,t2.rec_dept_acc from
(select b.contract_no,b.pay_account_no,b.rec_dept_name,b.pay_amt,b.rec_dept_acc from bi_retail_dc@DBLINK b where b.create_time > date '2017-01-03' and b.create_time < date '2017-01-04'
minus
select a.contract_no,a.pay_account_no,a.rec_dept_name,a.pay_amt,a.rec_dept_acc from bi_retail_dc a where a.create_time > date '2017-01-05')t2;

----------------------备份表后再修改

create table bi_retail_dd20170105 as
select * from bi_retail_dd;
update bi_retail_dc set state=2,FEEDBACK_RESULT=0 where create_time > date '2017-01-05' and create_time < date '2017-01-06'

--------------------

----------------------零售扣款需要改--------
select * from bp_batchsuborder where actdate=date'2017-1-5'
update bp_batchsuborder a set a.suborderstate=2 where actdate=date'2017-1-3'
-----------------------银行指令表
select * from bp_order where actdate=date'2017-1-5'
update bp_order set orderstate=2,transstate=1 where actdate=date'2017-1-4'

SELECT rowid, t.* from lc_acc_account t WHERE cust_code ='001' AND account_type ='1'
select * from cntbusssheet
select count(*) from bi_retail_dd a where a.feedback_result=1
--查询多维码不同
select t2.cust_id from
(select distinct (cust_id) from cntvoucher where vchdate = date '2017-1-3'
minus
select mcno from AMCODE where mgno = '10') t2;

--多维码凭证表
select * from cntvoucher where vchdate=date'2017-1-3' and vchmemo='收取月供'
--单据表
select * from cntbusssheet where actdate=date'2017-1-3'

-------------------------------------------------------------------------------

------库存放款数据比对

select t2.contract_no,t2.pay_amt,t2.pay_account_no,t2.rec_dept_acc,t2.vin_no from

(select a.contract_no,a.pay_amt,a.pay_account_no,a.rec_dept_acc,a.vin_no from bi_dc a where a.create_time > date '2017-01-03'

minus

select b.contract_no,b.pay_amt,b.pay_account_no,b.rec_dept_acc,b.vin_no from bi_dc@DBLINK b where b.create_time > date '2017-01-03') t2;

------库存扣款数据比对

select t2.vin_no,t2.pay_amt,t2.rec_account_no,t2.pay_name,t2.pay_acc from

(select a.vin_no,a.pay_amt,a.rec_account_no,a.pay_name,a.pay_acc from bi_dd a where a.create_time > date '2017-01-03'

minus

select b.vin_no,b.pay_amt,b.rec_account_no,b.pay_name,b.pay_acc from bi_dd@DBLINK b where b.create_time > date '2017-01-03') t2;

-----修改的语句
update bi_retail_dd a set a.state=2,a.FEEDBACK_RESULT=1 where
(a.CONTRACT_NO,a.PAY_AMT) not in
(select CONTRACT_NO,PAY_AMT from bi_retail_dddb20170105 b where
b.create_time > date '2017-01-03' and b.create_time < date '2017-01-04' and b.FEEDBACK_RESULT='0' )
and a.update_time>date'2017-1-3'
----------------------------------------------------------------------------------------------
update bi_retail_dd a set a.state=2,a.FEEDBACK_RESULT=0 where (a.CONTRACT_NO,a.PAY_AMT) in
(select CONTRACT_NO,PAY_AMT from bi_retail_dddb20170105 b where
b.create_time > date '2017-01-03' and b.create_time < date '2017-01-04' and b.FEEDBACK_RESULT='0' )
and a.update_time>date'2017-1-3'
------------------------------------------------------------------------------------------------
select * from bi_retail_dd a where
(a.CONTRACT_NO,a.PAY_AMT) in
(select CONTRACT_NO,PAY_AMT from bi_retail_dddb20170105 b where
b.create_time > date '2017-01-03' and b.create_time < date '2017-01-04' and b.FEEDBACK_RESULT='0' )
and a.update_time>date'2017-1-4'
----------------------------------------
--备份一下表数据
create table bi_retail_dddb20170105 as
select * from bi_retail_dd@DBLINK b where b.create_time > date '2017-01-03' and b.create_time < date '2017-01-04' and b.FEEDBACK_RESULT='0';
----------------------------------------

SQL总结之对比和备份的更多相关文章

  1. SQL Server如何提高数据库备份的速度

    对于一个数据库完整备份来说,备份的速度很大程度上取决于下面两个因素:读磁盘数据.日志文件的吞吐量,写磁盘数据文件的吞吐量. 下图是备份过程中磁盘的变化情况: 读吞吐量 读吞吐量的大小取决于磁盘读取数据 ...

  2. mysql与sql server参照对比学习mysql

    mysql与sql server参照对比学习mysql 关键词:mysql语法.mysql基础 转自桦仔系列:http://www.cnblogs.com/lyhabc/p/3691555.html ...

  3. SQL Server 批量主分区备份(Multiple Jobs)

    一.本文所涉及的内容(Contents) 本文所涉及的内容(Contents) 背景(Contexts) 案例分析(Case) 方案一(Solution One) 方案二(Solution Two) ...

  4. SQL Server 批量主分区备份(One Job)

    一.本文所涉及的内容(Contents) 本文所涉及的内容(Contents) 背景(Contexts) 案例分析(Case) 实现代码(SQL Codes) 主分区完整.差异还原(Primary B ...

  5. 1、SQL Server自动化运维 - 备份(一)业务数据库

    为了能够恢复数据,数据库运维基础就是备份,备份自动化也是运维自动化首要进行的. 笔者的备份自动化,通过配置表快速配置为前提,同时记录备份过程,尽可能的减少人工操作.首先将SQL Server备份按用途 ...

  6. SQL Server数据库定时自动备份

    SQL Server 数据库定时自动备份[转]   在SQL Server中出于数据安全的考虑,所以需要定期的备份数据库.而备份数据库一般又是在凌晨时间基本没有数据库操作的时候进行,所以我们不可能要求 ...

  7. SQL Server 维护计划实现数据库备份(策略实战)

    一.背景 之前写过一篇关于备份的文章:SQL Server 维护计划实现数据库备份,上面文章使用完整备份和差异备份基本上能解决数据库备份的问题,但是为了保障数据更加安全,我们需要再次完善我们的备份计划 ...

  8. SQL Server 维护计划实现数据库备份(Step by Step)(转)

    SQL Server 维护计划实现数据库备份(Step by Step) 一.前言 SQL Server 备份和还原全攻略,里面包括了通过SSMS操作还原各种备份文件的图形指导,SQL Server  ...

  9. SQL server 2008数据库的备份与还原、分离(转)

    SQL server 2008数据库的备份与还原.分离(转)   一.SQL数据库的备份: 1.依次打开 开始菜单 → 程序 → Microsoft SQL Server 2008 → SQL Ser ...

随机推荐

  1. Algorithm lecture

    当前标签: lecture   组合数求法讲解 BLADEVIL 2014-01-08 18:59 阅读:3 评论:0     mobius反演讲解 BLADEVIL 2014-01-08 18:13 ...

  2. 使用指定格式的字符串变量格式化日期字符串,DateAndTime取时间间隔

    private void btn_GetTime_Click(object sender, EventArgs e) { lab_time.Text = DateTime.Now.ToString(& ...

  3. vector cin

    vector<int>vec1,vec2; int ival; cout<<"Ender numbers for vector1(-1 to end):"& ...

  4. 在MVC中添加异常增加日志

    MVC的结构非常棒,基本你能想到注入的地方都可以找到地方,譬如IActionFilter,IResultFilter,IAuthorizationFilter以及IExceptionFilter 以下 ...

  5. ios学习之路四(新建Sprite Kit 项目的时候出现apple LLVM 5.0 error)

    在新建sprite kit 项目的时候出现"apple LLVM 5.0 error" 解决方法 在网上搜索,stackoverflow 上是这么说的点击打开链接.按照他的我也没解 ...

  6. ContentResolver + SqliteOpenHelper + ContentProvider 理解

    惭愧,现在才接触到ContentResolver的用法 这个类主要是Android用来实现应用程序之间数据共享的 一个应用程序可以将自己的数据完全暴露出去,外界更本看不到,也不用看到这个应用程序暴露的 ...

  7. hdu1358

    Problem Description For each prefix of a given string S with N characters (each character has an ASC ...

  8. 5款最好用的开源Web快速开发工具

    1.Aptana Studio Aptana是一个用于HTML,CSS和JavaScript的网站开发工具.目前在社区里有成千上万的人在开发Aptana的插件. Apatana Studio官网:ht ...

  9. 前端基于easyui的mvc扩展(续)

    前端基于easyui的mvc扩展(续) 回顾及遗留问题 上一篇讲解了基于easyui的mvc扩展的基本实现,已经降低了在mvc内使用easyui的难度,但是仍然还有一些问题: 当我们要给生成的控件设置 ...

  10. 持续集成环境(Hudson)搭建

    持续集成环境(Hudson)搭建 这是在公司写的,公司要求用英文,我也没时间翻译了.还请见谅! Hudson是个非常强大持续集成工具,配合svn,maven,sonar,redmine工具就更加完美了 ...