You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
sql-tools/检查余额和账户历史.sql

79 lines
997 B

SELECT * FROM
(
SELECT FCardId,FAcctId,FBalance
FROM TMemberCardAccount
) AS T1,
(
SELECT FCardId,FAcctId, SUM(FInAmount) - SUM(FOutAmount) AS FBalance
FROM TMemberCardAcctHist
GROUP BY FCardId,FAcctId
) AS T2
WHERE T1.FCardId = T2.FCardId
AND T1.FAcctId = T2.FAcctId
AND T2.FBalance != T1.FBalance
UPDATE A
SET A.FBalance = T2.FBalance
FROM TMemberCardAccount AS A,
(
SELECT FCardId,FAcctId, SUM(FInAmount) - SUM(FOutAmount) AS FBalance
FROM TMemberCardAcctHist
GROUP BY FCardId,FAcctId
) AS T2
WHERE a.FCardId = T2.FCardId
AND a.FAcctId = T2.FAcctId
AND a.FBalance != T2.FBalance
SELECT * FROM
(
SELECT FMemId,FMemNo,FPoint
FROM TMember
) AS T1,
(
SELECT FMemId, SUM(FInAmount) - SUM(FOutAmount) AS FPoint
FROM TMemberPointHist
GROUP BY FMemId
) AS T2
WHERE T1.FMemId = T2.FMemId
AND T2.FPoint != T1.FPoint
--未打开输入法
1 8
41 1e0001
--英文半角
1 8
41 1e0001
--英文全局
1 8
e5 1e0001
--中文半角
1 8
e5 1e0001
--中文全角
1 8
e5 1e0001