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. js高级技巧笔记(一)

    安全的类型检测 Js的类型检测机制并非完全可靠,发生错误否定及错误肯定的情况也不少: 在safari 在对正则表达式应用typeof操作符时返回"function",因此很难确定某 ...

  2. MyBatis对不同数据库的主键生成策略

    本文转自:http://289972458.iteye.com/blog/1001851  http://hi.baidu.com/zim_it/blog/item/8a2bd11205f5b56ec ...

  3. 查网卡信息(千M o 万M)

  4. [转载]再次谈谈easyui datagrid 的数据加载

    这篇文章只谈jQuery easyui datagrid 的数据加载,因为这也是大家谈论最多的内容.其实easyui datagrid加载数据只有两种方式:一种是ajax加载目标url返回的json数 ...

  5. Creating a new Signiant Transfer Engine because the previous transfer had to be canceled.

    From: http://stackoverflow.com/questions/10548196/application-loader-new-weird-warning-about-signian ...

  6. 一个比较全面的DJANGO_REST_FRAMEWORK的CASE

    验证啊,过滤啊,hypermedia as the engine of ap‐plication state (HATEOAS)啊都有的. urls.py __author__ = 'sahara' ...

  7. POJ2527+多项式除法

    模拟一遍即可. 注意一些特殊情况,见代码. #include<stdio.h> #include<stdlib.h> #include<math.h> #inclu ...

  8. poj 3440 Coin Toss 概率问题

    这题主要是推导数学公式!!! 将概率问题转化为圆心所在的面积! 代码如下: #include<iostream> #include<stdio.h> #include<a ...

  9. Android 使用httpClient POST 模拟发送 multipart表单内容

    使用的环境:apache-mime4j-0.6.jar,httpcore-4.3.2.jar,httpmime-4.3.3.jar try { HttpPost httpPost = new Http ...

  10. 你只是看起来很努力(只是做了一遍真题,草草的对了一遍答案,然后冲出自习室继续她学生会的事情了,骗自己更容易)good——想起了自己在六大时候的无奈

    (转)你只是看起来很努力一次上课,一个女孩子垂头丧气的跟我说,老师,我考了四次四级,还没过,究竟是为什么. 我说,你真题做了吗?单词背了吗?她拿出已经翻破了的真题,跟我说,你讲的所有的题目我连答案都记 ...