USE JinZhou_KUnLI

SELECT * FROM TMemberCard WHERE FValueType = 3

UPDATE TMemberCard SET FExpiredDate  = '9999-01-01 00:00:00.000'
SELECT * FROM TMemberCardType WHERE FNo = '102'
SELECT * FROM TMemberCard WHERE FTypeId = 8859394653322192570

DELETE TMemberCard WHERE FCardId = 5423554175841329846
DELETE TMemberCardAccount WHERE FCardId = 5423554175841329846
DELETE TMemberCardAcctHist WHERE FCardId = 5423554175841329846

SELECT * FROM TCourse 

SELECT * FROM dbo.Member_Account

SELECT * FROM TMemberCard 

SELECT * FROM dbo.Member_CardInfo ,TMemberCard
WHERE intStatus != 0
AND vhrCardNo = FCardNo 


SELECT * FROM dbo.Member_CardInfo WHERE vhrCardNo = '1036'

SELECT * FROM TImpMember2 WHERE FCardNO = '800219'

WHERE decTimeRate is null
AND intCardTypeId IN(SELECT intId FROM Member_CardType WHERE ISNULL(intSaleType,0) = 2)

WHERE vhrCardNo = '2927'

UPDATE A
   SET A.FTotalTimes = ISNULL(b.intTime,0),
       A.FUsedTimes = 0
  FROM TMemberCard AS A,TMemberCardAccount AS C,Member_CardInfo AS B
 WHERE A.FCardNO = B.vhrCardNo
   AND A.FCardId = C.FCardId
   AND A.FValueType= 3 
   AND intStatus != 1 
   
  UPDATE A
   SET A.FTotalTimes = ISNULL(b.intTime,0),
       A.FUsedTimes = 0
  FROM TMemberCard AS A,TMemberCardAccount AS C,Member_CardInfo AS B
 WHERE A.FCardNO = B.vhrCardNo + '_2'
   AND A.FCardId = C.FCardId
   AND A.FValueType= 3 
   AND intStatus != 1  
   
   
   
   SELECT * FROM TMemberCard WHERE FCardNO = '1001'
   
UPDATE C
   SET C.FDeposit = ROUND((B.decTimeMoney / decTimeRate) *  ISNULL(b.intTime,0),2),
       C.FBalance = ROUND((B.decTimeMoney / decTimeRate) *   ISNULL(b.intTime,0),2)
  FROM TMemberCard AS A,TMemberCardAccount AS C,Member_CardInfo AS B
 WHERE A.FCardNO = B.vhrCardNo
   AND A.FCardId = C.FCardId
   AND A.FValueType= 3 
    AND intStatus != 1 
   
UPDATE C
   SET C.FDeposit = ROUND((B.decTimeMoney / decTimeRate) *  ISNULL(b.intTime,0),2),
       C.FBalance = ROUND((B.decTimeMoney / decTimeRate) *   ISNULL(b.intTime,0),2)
  FROM TMemberCard AS A,TMemberCardAccount AS C,Member_CardInfo AS B
 WHERE A.FCardNO = B.vhrCardNo + '_2'
   AND A.FCardId = C.FCardId
   AND A.FValueType= 3 
    AND intStatus != 1 
   
   
   SELECT * FROM TMemberCardAccount
   
UPDATE A
   SET A.FValueType = B.FValueType
  FROM TMemberCard AS A,TMemberCardType AS B
 WHERE A.FTypeID = B.FId
 
       
       
SELECT * FROM TMemberCard AS A,TMemberCardAccount AS B
WHERE A.FCardId = B.FCardId
AND A.FTypeId IN(SELECT FId FROM TMemberCardType WHERE FValueType = 3)

UPDATE

SELECT * FROM Member_CardType 

SELECT * FROM TMemberCard WHERE FCardNo = '2927'
SELECT * FROM TMemberCard WHERE FValueType = 3

SELECT * FROM TMemberCardAccount WHERE FCardid = 5349498091377853467

SELECT A.FId,A.FNo,A.FName,B.* FROM TMemberCardType AS A,Member_CardType AS B
WHERE B.vhrName = A.FName
AND ISNULL(intSaleType,0) = 2

UPDATE A 
   SET A.FValueType = 3,
       A.FDeposit = decTimeMoney,
       A.FTimes = B.decTimeRate,
       A.FPrice = decTimeMoney
  FROM TMemberCardType AS A,Member_CardType AS B
 WHERE B.vhrName = A.FName
AND ISNULL(intSaleType,0) = 2