CREATE TABLE #MoneyTable
(
Id INT IDENTITY(1, 1)
PRIMARY KEY ,
MoneyName VARCHAR(50) ,
Cents INT
)
INSERT INTO #MoneyTable
( MoneyName, Cents )
VALUES ( 'UnSupported', 0 )
INSERT INTO #MoneyTable
( MoneyName, Cents )
VALUES ( 'DollarOne', 100 )
INSERT INTO #MoneyTable
( MoneyName, Cents )
VALUES ( 'DollarTwo', 200 )
INSERT INTO #MoneyTable
( MoneyName, Cents )
VALUES ( 'DollarFive', 500 )
INSERT INTO #MoneyTable
( MoneyName, Cents )
VALUES ( 'DollarTen', 1000 )
INSERT INTO #MoneyTable
( MoneyName, Cents )
VALUES ( 'DollarTwenty', 2000 )
INSERT INTO #MoneyTable
( MoneyName, Cents )
VALUES ( 'DollarFifty', 5000 )
INSERT INTO #MoneyTable
( MoneyName, Cents )
VALUES ( 'DollarHundred', 10000 )
INSERT INTO #MoneyTable
( MoneyName, Cents )
VALUES ( 'CentOne', 1 )
INSERT INTO #MoneyTable
( MoneyName, Cents )
VALUES ( 'CentFive', 5 )
INSERT INTO #MoneyTable
( MoneyName, Cents )
VALUES ( 'CentTen', 10 )
INSERT INTO #MoneyTable
( MoneyName, Cents )
VALUES ( 'CentTwentyFive', 25 )
INSERT INTO #MoneyTable
( MoneyName, Cents )
VALUES ( 'CentFifty', 50 ) SELECT id ,
Payload.value('(TransactionJournal/TransactionDetail/BillBreakTransactionDetail/BillBreakDetail/MoneyDenom/denom)[1]',
'varchar(50)') AS 'MoneyName' ,
Payload.value('(TransactionJournal/TransactionDetail/Amount)[1]',
'int') AS 'Cents' ,
Payload.value('(TransactionJournal/TransactionDualDetail/BillBreakTransactionDetail/BillBreakDetail/MoneyDenom/denom)[1]',
'varchar(50)') AS 'DualMoneyName' ,
Payload.value('(TransactionJournal/TransactionDualDetail/Amount)[1]', --2.Search the specified node in the specified field
'int') AS 'DualCents'
INTO #tempJournal --1.Don't to state create #tempJournal
FROM Kiosk.Journal
WHERE ModuleTypeId = 3 SELECT *
FROM Kiosk.Journal
WHERE id NOT IN ( SELECT t1.id
FROM #tempJournal t1 ,
#MoneyTable t2
WHERE ( t1.MoneyName = t2.MoneyName
AND t1.Cents = t2.Cents
AND t1.DualMoneyName IS NULL
AND t1.DualCents IS NULL
)
OR ( t1.DualMoneyName = t1.MoneyName
AND t1.DualCents = t2.Cents
AND t1.MoneyName IS NULL
AND t1.Cents IS NULL
) )
AND ModuleTypeId = 3 DROP TABLE #MoneyTable
DROP TABLE #tempJournal

We need the sql script to query the table Ditronics.Kiosk.Journal to find journal with mismatch denom information versus amount.的更多相关文章

  1. MySQL5.7: sql script demo

    -- MyISAM Foreign Keys显示不了外键,MyISAM此为5.0 以下版本使用 InnoDB 为5.0以上版本使用 drop table IF EXISTS city; CREATE ...

  2. SQLite: sql script demo

    如果有成熟的架构,如何根据数据库关系的表.视图等,进行代码生成架构?减少写代码的时间? -- 考虑主键外键 -- create database geovindu; use geovindu; --2 ...

  3. csharp:SMO run sql script

    using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; usin ...

  4. doris: shell invoke .sql script for doris and passing values for parameters in sql script.

    1. background in most cases, we want to execute sql script  in doris  routinely. using azkaban, to l ...

  5. 解决java.sql.SQLException: ORA-01789: query block has incorrect number of result columns

    java.sql.SQLException: ORA-01789: query block has incorrect number of result columns at oracle.jdbc. ...

  6. 可重复执行的SQL Script

    问题 在工作中偶尔会遇到这样的问题:SQL script重复执行时会报错. 理想的状态下,SQL script跑一遍就够了,是不会重复执行的,但是实际情况往往很复杂. 比如Dev同学在开发时在A环境把 ...

  7. How to Enable Trace or Debug for APIs executed as SQL Script Outside of the Applications ?

    In this Document   Goal   Solution   1: How do you enable trace for an API when executed from a SQL ...

  8. How to import .sql script

    How to import .sql script 1.Export .sql from pl/sql developer you can reference to other document in ...

  9. persistent.xml hibernate 利用sql script 自定义生成 table 表

    <?xml version="1.0" encoding="UTF-8"?> <persistence xmlns="http:// ...

随机推荐

  1. ExtJs 4.2.1 报错:Uncaught TypeError: Cannot call method 'getItems' of null

    做项目的时候遇到这个问题,搞了一上午终于解决了,让我们看看是什么问题: buttons: [ { text: '保存', icon: '../../../Images/extjs/disk.png', ...

  2. vim查看函数原型以及关闭窗口

    问题描述:         vim中查看函数原型,以及关闭vim窗口 问题解决:      (1)查看函数原型            使用Shift+K可以查看用户手册      (2)自定义函数   ...

  3. hdu 4726

    贪心 不是很难  各种细节注意 #include <cstdio> #include <cstring> #include <algorithm> using na ...

  4. Android Activity交互及App交互

    Android交互--------->Intent Activity之间----->Explicit Intent App之间--------->Implicit Intent

  5. [Firefly引擎][学习笔记二][已完结]卡牌游戏开发模型的设计

    源地址:http://bbs.9miao.com/thread-44603-1-1.html 在此补充一下Socket的验证机制:socket登陆验证.会采用session会话超时的机制做心跳接口验证 ...

  6. RASP 完爆 WAF 的5大理由!

    Web 应用防火墙(WAF)已经成为常见 Web 应用普遍采用的安全防护工具,即便如此,WAF 提供的保护方案仍旧存在诸多不足,笔者认为称 WAF 为好的安全监控工具更为恰当.幸运的是,应用安全保护技 ...

  7. 【网络】IP地址分配、端口号、分层

    3.网络分层 OSI的七层网络结构图和TCP/IP的五层结构图 OSI七层模型OSI中的层            功能                                          ...

  8. VIM的高级使用

    VIM的高级使用  转:http://www.cnblogs.com/itech/archive/2012/02/22/2363111.html 1)一些常用的Vim配置,在~/.vimrc中 syn ...

  9. 一个UUID生成算法的C语言实现 --- WIN32版本 .

    一个UUID生成算法的C语言实现——WIN32版本   cheungmine 2007-9-16   根据定义,UUID(Universally Unique IDentifier,也称GUID)在时 ...

  10. eclipse查看jar包中class的中文注释乱码问题的解决

    1,问题来源是在eclipse中直接查看springside的class(由eclipse自动反编译)里面注释的乱码问题: Preferences-General-Workspace-Text fil ...