SELECT * FROM TMember WHERE FMemNo = 'M60117' SELECT T.FBillNo,A.FMemNo,C.FId,C.FCourseId,C.FUsedPurTimes,FRemainPurTimes,FQuantity FROM TMember AS A,TMemberCourse AS C,TConsumeItem AS B,TConsumeBill AS T WHERE A.FMemId = C.FMemId AND B.FMemCourseId = C.FId AND B.FBillId = T.FBillId AND FQuantity BETWEEN 0.0000000001 AND 0.999999999 AND FMemCourseId != 0 ORDER BY A.FMemId SELECT * FROM TConsumeItem WHERE FQuantity BETWEEN 0.0000000001 AND 0.999999999 AND FMemCourseId != 0 sp_helptext 'PAuditConsumeBillDeductCourseCombo' SELECT * FROM TCourse WHERE FNo = '134L1' SELECT * FROM TMemberCourse WHERE FCourseId = 5356163704215304574 AND FMemId = 6699664699297822344 SELECT * FROM TMemberCourseHist WHERE FCourseId = 5356163704215304574 AND FMemId = 6699664699297822344 SELECT * FROM TConsumeItem WHERE FMemCourseId = 7246236641065723772 SELECT *FROM TUser SELECT TCompany.FNo,T.FBillNo,A.FMemNo,C.FId,C.FCourseId,C.FUsedPurTimes,FRemainPurTimes,FQuantity--,SUM(FQuantity) AS FQuantity INTO TMemberCourseAdjust_1 FROM TMember AS A,TMemberCourse AS C,TConsumeItem AS B,TConsumeBill AS T,TCompany WHERE A.FMemId = C.FMemId AND B.FMemCourseId = C.FId AND B.FBillId = T.FBillId AND T.FState = 1 AND FQuantity BETWEEN 0.0000000001 AND 0.999999999 AND FMemCourseId != 0 AND T.FModifiedFlag != 0 AND TCompany.FId = T.FCompId ORDER BY A.FMemId SELECT TCompany.FNo,T.FBillNo,A.FMemNo,C.FId,C.FCourseId,C.FUsedPurTimes,FRemainPurTimes,FQuantity--,SUM(FQuantity) AS FQuantity FROM TMember AS A,TMemberCourse AS C,TConsumeItem AS B,TConsumeBill AS T,TCompany WHERE A.FMemId = C.FMemId AND B.FMemCourseId = C.FId AND B.FBillId = T.FBillId AND T.FState = 1 AND FQuantity BETWEEN 0.0000000001 AND 0.999999999 AND FMemCourseId != 0 AND TCompany.FId = T.FCompId --AND B.FMemCourseId NOT IN(SELECT FMemCourseId FROM TMemberCourseAdjust_1) ORDER BY A.FMemId SELECT * FROM TConsumeItem AS A INNER JOIN TConsumeBill AS T ON T.FBillId = A.FBillId AND T.FState = 1 WHERE FMemCourseId = 8800688421790076938 SELECT SUM(FQuantity) FROM TConsumeItem AS A INNER JOIN TConsumeBill AS T ON T.FBillId = A.FBillId AND T.FState = 1 WHERE FMemCourseId = 8800688421790076938 SELECT * FROM TMemberCourseHist WHERE FMemCourseId = 8800688421790076938 SELECT * FROM TMemberCourse WHERE FId = 8800688421790076938 SELECT * FROM TBKCourse# WHERE FId = 8800688421790076938 UPDATE TMemberCourse SET FUsedPurTimes = 6 WHERE FId = 8800688421790076938 SELECT * FROM TMemberCourseHist WHERE FUsePurTimes > 0