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/temp/检查MemId = 0的问题.sql

55 lines
1.6 KiB

1 year ago
DELETE TMemberCardAcctHist WHERE FBillType = 'QT' AND FTime > '2015-10-17'
USE QingDao_MaLin
GO
SELECT * FROM TUser WHERE FId = 1
SELECT * FROM TConsumeBill WHERE FMemID = 0 AND FCardId != 0
SELECT * FROM TMemberCardAcctHist WHERE FMemId = 0
SELECT * FROM TMemberCard WHERE FCardId = '6558538575374820441'
UPDATE TMemberCardAcctHist SET FMemID = 8076595112125237491 where FCardid = 6558538575374820441
SELECT * FROM TMemberCardAcctHistBak WHERE FCardId = 694
SELECT * FROM TMemberCardAcctHist WHERE FTime > '2015-08-21 17:55:43' AND FBillType = 'DR'
UPDATE TConsumeBill SET FModifiedFlag = 0 WHERE FBillTime > '2015-10-16'
DECLARE @CardId BIGINT
SELECT @CardId = FCardId FROM TMemberCard WHERE FCardNo = 'A00892'
SELECT * FROM TMemberCardAcctHist WHERE FCardId = @CardId
SELECT * FROM TMemberCardAcctHist WHERE FMemID = 0
delete TMemberCardAcctHist WHERE FMemId = 0
EXEC PRecalcCardAccHistBalance @CardId
SELECT 'EXEC PRecalcCardAccHistBalance ' + CAST(FCardId AS VARCHAR(20)) FROM TMemberCard
SELECT * FROM TMemberCardAcctHistBAK WHERE FCardId = '939'
00907
SELECT * INTO TMemberCardAcctHistBAK FROM TMemberCardAcctHist
INSERT TMemberCardAcctHist SELECT * FROM TMemberCardAcctHistBAK WHERE FBillType = 'DR'
DELETE TMemberCardAcctHist WHERE FBillType = 'DR'
DELETE A
FROM TMemberCardAcctHist AS A,(
SELECT FCardId,FAcctId,MAX(FTime) AS FTime,COUNT(1) AS A
FROM TMemberCardAcctHist
WHERE FBillType = 'DR'
GROUP BY FCardId,FAcctId
HAVING(COUNT(1)) > 1
) AS B
WHERE A.FCardId = B.FCardId
AND A.FAcctId = B.FAcctId
AND A.FTime = B.FTime
DELETE TMemberCardAcctHist WHERE FCardId =
(SELECT FCardId FROM TMemberCard WHERE FCardNo = '801133' AND FBillType = 'DR')