We need the sql script to query the table Ditronics.Kiosk.Journal to find journal with mismatch denom information versus amount.


        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.

时间: 2024-08-30 07:58:43

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

csharp:SMO run sql script

using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using Microsoft.SqlServer.Management.Common;//需添加microsoft.sqlserv

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 load data,etc.And we want to pass parameters to the sql script file. we can easily handle such situation in hive. 1.1 hive usage: using -hiveconf:  or

解决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.driver.DatabaseError.throwSqlException(DatabaseError.java:125) at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:305) at oracle.jdbc.driver.

Spark SQL: Error in query: undefined function错误的解决方法

本文原文出处: http://blog.csdn.net/bluishglc/article/details/50748937 严禁任何形式的转载,否则将委托CSDN官方维护权益! 问题描述 如果你在Spark SQL上试图调用在HIVE注册的自定义函数(UDF)时,你可能会遇到这样的错误: Spark SQL: Error in query: undefined function xxxxxx 这个问题发生在Spark 1.5.0, 1.5.1和1.5.2版本上,对此Spark官方有一个专门的

Delete All Umbraco Members by SQL Script (转自http://staheri.com/my-blog/2015/july/delete-all-umbraco-members-by-sql-script/)

Today I had to take the back-up off a live site and restore it on the staging server. However I had to remove all Umbraco members and thought it'd be easier to do that with SQL script than API. Despite Googling to find a firm solution (SQL script), I

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 script outside of Oracle Applications ?   2: How do you get debug log for an API when executed from a SQL script outside of Oracle Applications ?   a)

SQL 创建联合主键Table

CREATE TABLE [User_Instance]( [IntanceID] [int] NOT NULL, [StaffID] [char](10) NOT NULL ) ON [PRIMARY] GO SET ANSI_PADDING OFF GO ALTER TABLE [[User_Instance] WITH NOCHECK ADD CONSTRAINT [PK_User_Instance] PRIMARY KEY NONCLUSTERED ( IntanceID, StaffI

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

<?xml version="1.0" encoding="UTF-8"?> <persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns

sql for xml query sample

sample 1: declare @x xml select @x='<ArrayOfScheduledTime> <ScheduledTime> <RecurrenceType>EveryMonday</RecurrenceType> <Stamp> <dateTime>2000-01-01T19:30:00</dateTime> </Stamp> </ScheduledTime> <Sc