`
wandejun1012
  • 浏览: 2737995 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

诡异SQL研究

    博客分类:
  • DB
 
阅读更多

SELECT ISNULL(ED.RegNo,'') as RegNo,ISNULL(ED.RefNo,'') as RefNo , ISNULL(ED.RoundNo,'') as RoundNo, ISNULL(S.RefDate_Sett,'') as RefDate_Sett , ISNULL(EH.PayAccount,'') as PayAccount , ISNULL(EH.PayAccountNmCN,'') as PayAccountNmCN , ISNULL(EH.PayAccountNmEN,'') as PayAccountNmEN , ISNULL(EH.ClCmtNo,'') as ClCmtNo, ISNULL(EH.ClCmtAccSbjtName,'') as ClCmtAccSbjtName, ISNULL(EH.ReceiptAccount,'') as ReceiptAccount , ISNULL(EH.ReceiptAccSbjt,'') as ReceiptAccSbjt , ISNULL(R.BillTypeNm,'') as BillTypeNm , ISNULL(R.BillTypeVal,'') as BillTypeVal , ISNULL(R.BAPerson,'') as BAPerson , ISNULL(R.AcpnBillNo,'') as AcpnBillNo, R.BillAmt as BillAmt, ISNULL(R.BilExecDate,'') as BilExecDate, ISNULL(R.BilMatDate,'') as BilMatDate, ISNULL(R.BillPayerIsDiffPlaceNm,'') as BillPayerIsDiffPlaceNm, ISNULL(EH.DiscBeginDate,'') as DiscBeginDate , ISNULL(EH.ExistRecourseVal,'') as ExistRecourseVal , ISNULL(ED.DiscMatDate,'') as DiscMatDate , ISNULL(S.BilSettDate,'') as BilSettDate , ISNULL(S.Account1,'') as Account1 , ISNULL(S.AcTtlSub1,'') as AcTtlSub1 , S.AccAmt1 as AccAmt1 , ISNULL(S.Account2,'') as Account2, ISNULL(S.AcTtlSub2,'') as AcTtlSub2, S.AccAmt2 as AccAmt2, ISNULL(S.Account3,'') as Account3 , ISNULL(S.AcTtlSub3,'') as AcTtlSub3 , S.AccAmt3 as AccAmt3 , ISNULL(S.IsExpiredVal,'') as IsExpiredVal , ISNULL(S.ExpiInterestRate,0) as ExpiInterestRate , ISNULL(S.ExpiPunishIntt,0) as ExpiPunishIntt , ISNULL(S.ExpiPunishAccount,'') as ExpiPunishAccount, ISNULL(S.ExpiPunishAcTtlSub,'') as ExpiPunishAcTtlSub, ISNULL(S.IsBuybackVal,'') as IsBuybackVal, ISNULL(S.RefusePayRsnDate,'') as RefusePayRsnDate, ISNULL(S.BillOriBackDate,'') as BillOriBackDate, ISNULL(S.BuyBackDate,'') as BuyBackDate, ISNULL(S.MakerId,'') as MakerId , ISNULL(S.MakerNm,'') as MakerNm , ISNULL(S.ChkerId,'') as ChkerId , ISNULL(S.ChkerNm,'') as ChkerNm , ISNULL(S.ApproverId,'') as ApproverId , ISNULL(S.ApproverNm,'') as ApproverNm , ISNULL(S.RejecterId,'') as RejecterId , ISNULL(S.RejecterNm,'') as RejecterNm , ISNULL(S.SettStasValue,'') as SettStasValue , ISNULL(S.SettStasName,'') as SettStasName , ISNULL(S.Remark1,'') as Remark1 , ISNULL(S.Remark2,'') as Remark2 , ISNULL(S.Remark3,'') as Remark3 , ISNULL(S.Remark4,'') as Remark4 , ISNULL(S.Remark5,'') as Remark5 , ISNULL(S.DelReason,'') as DelReason , ISNULL(S.UpdDate,'') as UpdDate , ISNULL(S.UpdateCount,0) as UpdateCount 
  FROM  B_DiscountExecH EH INNER JOIN B_DiscountExecD ED ON EH.DiscountNo=ED.DiscountNo 
  INNER JOIN B_DiscountReg  R on R.RegNo=ED.RegNo 
  INNER JOIN B_DiscountSett  S on S.RegNo=ED.RegNo 
  WHERE R.RegNo='B11091316014189' 
  AND EH.DiscountNo='000000000011' 
  AND ED.BookingBranch='8879' 
  AND ED.AmendCount=(
  SELECT isnull(MAX(AmendCount),0) as AmendCount FROM B_DiscountExecD  WHERE RegNo='B11091316014189'AND  BookingBranch='8879'AND  DiscountNo='000000000011'
  ) 
  AND S.UpdateCount=
  (
  SELECT isnull(MAX(UpdateCount),0) as UpdateCount  FROM B_DiscountSett  WHERE RegNo='B11091316014189'AND  BookingBranch='8879'
  )

 和下面的一段:

SELECT ISNULL(ED.RegNo,'') as RegNo,ISNULL(ED.RefNo,'') as RefNo , ISNULL(ED.RoundNo,'') as RoundNo, ISNULL(S.RefDate_Sett,'') as RefDate_Sett , ISNULL(EH.PayAccount,'') as PayAccount , ISNULL(EH.PayAccountNmCN,'') as PayAccountNmCN , ISNULL(EH.PayAccountNmEN,'') as PayAccountNmEN , ISNULL(EH.ClCmtNo,'') as ClCmtNo, ISNULL(EH.ClCmtAccSbjtName,'') as ClCmtAccSbjtName, ISNULL(EH.ReceiptAccount,'') as ReceiptAccount , ISNULL(EH.ReceiptAccSbjt,'') as ReceiptAccSbjt , ISNULL(R.BillTypeNm,'') as BillTypeNm , ISNULL(R.BillTypeVal,'') as BillTypeVal , ISNULL(R.BAPerson,'') as BAPerson , ISNULL(R.AcpnBillNo,'') as AcpnBillNo, R.BillAmt as BillAmt, ISNULL(R.BilExecDate,'') as BilExecDate, ISNULL(R.BilMatDate,'') as BilMatDate, ISNULL(R.BillPayerIsDiffPlaceNm,'') as BillPayerIsDiffPlaceNm, ISNULL(EH.DiscBeginDate,'') as DiscBeginDate , ISNULL(EH.ExistRecourseVal,'') as ExistRecourseVal , ISNULL(ED.DiscMatDate,'') as DiscMatDate , ISNULL(S.BilSettDate,'') as BilSettDate , ISNULL(S.Account1,'') as Account1 , ISNULL(S.AcTtlSub1,'') as AcTtlSub1 , S.AccAmt1 as AccAmt1 , ISNULL(S.Account2,'') as Account2, ISNULL(S.AcTtlSub2,'') as AcTtlSub2, S.AccAmt2 as AccAmt2, ISNULL(S.Account3,'') as Account3 , ISNULL(S.AcTtlSub3,'') as AcTtlSub3 , S.AccAmt3 as AccAmt3 , ISNULL(S.IsExpiredVal,'') as IsExpiredVal , ISNULL(S.ExpiInterestRate,0) as ExpiInterestRate , ISNULL(S.ExpiPunishIntt,0) as ExpiPunishIntt , ISNULL(S.ExpiPunishAccount,'') as ExpiPunishAccount, ISNULL(S.ExpiPunishAcTtlSub,'') as ExpiPunishAcTtlSub, ISNULL(S.IsBuybackVal,'') as IsBuybackVal, ISNULL(S.RefusePayRsnDate,'') as RefusePayRsnDate, ISNULL(S.BillOriBackDate,'') as BillOriBackDate, ISNULL(S.BuyBackDate,'') as BuyBackDate, ISNULL(S.MakerId,'') as MakerId , ISNULL(S.MakerNm,'') as MakerNm , ISNULL(S.ChkerId,'') as ChkerId , ISNULL(S.ChkerNm,'') as ChkerNm , ISNULL(S.ApproverId,'') as ApproverId , ISNULL(S.ApproverNm,'') as ApproverNm , ISNULL(S.RejecterId,'') as RejecterId , ISNULL(S.RejecterNm,'') as RejecterNm , ISNULL(S.SettStasValue,'') as SettStasValue , ISNULL(S.SettStasName,'') as SettStasName , ISNULL(S.Remark1,'') as Remark1 , ISNULL(S.Remark2,'') as Remark2 , ISNULL(S.Remark3,'') as Remark3 , ISNULL(S.Remark4,'') as Remark4 , ISNULL(S.Remark5,'') as Remark5 , ISNULL(S.DelReason,'') as DelReason , ISNULL(S.UpdDate,'') as UpdDate , ISNULL(S.UpdateCount,0) as UpdateCount 
  FROM  B_DiscountExecH EH INNER JOIN B_DiscountExecD ED ON EH.DiscountNo=ED.DiscountNo 
  INNER JOIN B_DiscountReg  R on R.RegNo=ED.RegNo 
  INNER JOIN B_DiscountSett  S on S.RegNo=ED.RegNo 
  WHERE R.RegNo='B11091316014189' 
  AND EH.DiscountNo='000000000011' 
  AND ED.BookingBranch='8879' 
  AND ED.AmendCount=(
  SELECT isnull(MAX(AmendCount),0) as AmendCount FROM B_DiscountExecD  WHERE RegNo='B11091316014189'AND  BookingBranch='8879'AND  DiscountNo='000000000011'
  ) 
  AND S.UpdateCount=
  (
  SELECT isnull(MAX(UpdateCount),0) as UpdateCount  FROM B_DiscountSett  WHERE ED.RegNo='B11091316014189'AND  ED.BookingBranch='8879'
  )
 看上去意思差不多,到底有何区别?出来的结果有时也不一样。
分享到:
评论

相关推荐

    SQL 语法 SQL 总结 SQL教程

    SQL 基础 SQL 首页 SQL 简介 SQL 语法 SQL select SQL distinct SQL where SQL AND & OR SQL Order By SQL insert SQL update SQL delete SQL 高级 SQL Top SQL Like SQL 通配符 SQL In SQL Between ...

    SQL Prompt插件, 支持SQL2019+SSMS18.5,仅用于学习研究. 不得用于商业用处!

    在学习和研究环境中,SQL Prompt提供了多种功能,包括自动完成、代码格式化、性能建议等,但使用者必须注意,这个版本仅供非商业用途。 1. **自动完成**:SQL Prompt提供智能感知功能,可以在编写SQL语句时自动补全...

    sql server 导入超大SQL脚本文件

    SQL Server 导入超大 SQL 脚本文件 SQL Server 是一种关系型数据库管理系统,广泛应用于各种行业。然而,在实际应用中,我们经常会遇到导入超大 SQL 脚本文件的问题。本文将介绍如何使用 osql 工具来导入超大 SQL ...

    SQL优化 SQL优化软件 SQL优化工具

    SQL优化是数据库管理中的关键环节,它涉及到提升查询性能、减少资源消耗以及改善系统整体效率。SQL优化软件和工具能够帮助数据库管理员(DBA)和开发人员找出性能瓶颈,优化查询逻辑,从而提高数据库系统的响应速度...

    sqlserver自动生成sql语句工具sqlserver转oracle

    在IT行业中,数据库管理系统是核心组成部分,SQL Server和Oracle分别是微软和甲骨文公司推出的两款广泛应用的关系型数据库系统。在企业级应用中,有时需要在不同的数据库系统间进行数据迁移或兼容性处理,这就涉及到...

    SQLPrompt for SQLServer2016 智能提示插件 SQL2016 提示

    SQLPrompt for SQLServer2016 智能提示插件 SQL2016 提示 SQLPrompt最新版本 绿色版 SQL Prompt 是一款拥有SQL智能提示功能的SQL Server和VS插件。SQL Prompt能根据数据库的对象名称,语法和用户编写的代码片段自动...

    基于Web的SQL注入漏洞扫描系统的设计研究

    对SQL注入漏洞给相应检测及防御技术进行研究,通过本地创建的实验环境,将Pubs数据库作为案例和多种渗透方法实现SQL注入实验。以SQL注入攻击特点为基础,提出四种具体防御措施。实验表示,此防御措施Web应用系统能够...

    商城sql完整sql

    商城sql商城sql商城sql商城sql商城sql商城sql商城sql商城sql

    SQLTracker,抓取sql语句的工具

    SQLTracker是一款专为数据库操作监控设计的工具,它在IT领域中主要用于跟踪和记录SQL语句的执行情况。SQL(Structured Query Language)是用于管理关系数据库的编程语言,包括查询、更新、插入和删除数据等操作。SQL...

    SQLMonitor oracle跟踪SQL工具

    《SQLMonitor:Oracle数据库SQL跟踪与分析利器》 在IT行业中,数据库的高效管理与优化是至关重要的。针对Oracle数据库,有一款名为SQLMonitor的工具,它专为跟踪和监控SQL语句而设计,帮助开发者和DBA们找出程序...

    kettle链接SQL server驱动 sqljdbc

    在Kettle中配置SQL Server数据库连接时,我们需要依赖特定的数据库驱动,这就是SQL JDBC驱动。 SQL JDBC驱动是微软提供的Java Database Connectivity (JDBC) 驱动,使得Java应用程序能够与SQL Server进行交互。有两...

    SqlParser C++实现的SQL语法解释器

    SqlParser是一款基于C++实现的SQL语法解释器,它的主要任务是解析SQL语句,将其转化为计算机可理解的形式,从而能够执行相应的数据库操作。在数据库系统中,SQL(Structured Query Language)是用于管理关系数据库的...

    sqlserver驱动包:sqljdbc4.jar

    SQL Server驱动包`sqljdbc4.jar`是微软官方提供的Java数据库连接器(JDBC),用于在Java应用程序中与Microsoft SQL Server进行通信。JDBC是Java编程语言中的一个标准API,它使得开发人员能够以标准化的方式访问各种...

    sql注入字典fuzz

    为了有效地检测和防范此类攻击,安全研究人员和工程师们常常会采用SQL注入字典(SQL Injection Dictionary)来进行模糊测试(Fuzzing)。本文将深入探讨SQL注入字典fuzz的相关知识点。 #### 二、SQL注入基础 SQL...

    Microsoft SQL Server Native Client (SQL Native Client)

    Microsoft SQL Server Native Client (SQL Native Client) 是一个同时包含 SQL OLE DB 访问接口和 SQL ODBC 驱动程序的动态链接库 (DLL)。它对使用本机代码 API(ODBC、OLE DB 和 ADO)连接到 Microsoft SQL Server ...

    Oracle Sql语句转换成Mysql Sql语句

    在数据库管理领域,Oracle SQL和MySQL SQL是两种广泛使用的SQL方言,它们在语法和功能上存在一定的差异。当需要将一个基于Oracle SQL的应用程序迁移到MySQL环境时,就需要进行SQL语句的转换工作。本项目提供了一个...

    SqlServer连接工具

    SQL Server连接工具是数据库管理员和开发人员用于与Microsoft SQL Server交互的重要软件。这些工具提供了多种功能,包括数据库的创建、管理、查询、备份、恢复以及性能优化等。在本篇文章中,我们将深入探讨SQL ...

    SqlServer2005 打开 SqlServer2008 mdf文件

    Sql Server 2005 打开 Sql Server 2008 mdf 文件数据库转换是指将 Sql Server 2008 中的数据库文件(mdf 文件)转换为 Sql Server 2005 可以识别的格式,以便在 Sql Server 2005 中使用。这种转换过程需要使用 Sql ...

Global site tag (gtag.js) - Google Analytics