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

15 lines
564 B

use qingdao_vstar
SELECT A.FNo + A.FName as ,I.FNo + '-' + I.FName as ,Comp.FNo+'-'+Comp.FAbbr,
M.FMemNO as ,M.FName as ,
M.FMobilePHone as , CAST(C.FRemainPurTimes AS FLOAT) AS ,C.FRemainFreeTimes
FROM TCoursePack AS A,TMemberCoursePack AS B
left join TCompany AS Comp on comp.FId = B.FCompId
,TMemberCourse AS C,TItem AS I,TMember AS M
WHERE C.FMemPackId = B.FId
AND B.FPackId = A.FId
AND I.FId = C.FItemId
AND M.FMemId = B.FMemId
AND M.FDeleted = 0
AND (C.FRemainPurTimes + C.FRemainFreeTimes) > 0
ORDER BY A.FNo ,I.FNo