power
SELECT TOP 1 @DIRECT_COUNT_LEVEL=X.LEVEL, @TEAM_SIZE=X.P FROM (
SELECT LEVEL,COUNT(DISTINCT JCODE) AS P,POWER(4,LEVEL) AS QM FROM AMTPAIRDTL WHERE LEVEL<=5 AND MEMB_CODE=@PLACID GROUP BY LEVEL
) AS X WHERE X.P=X.QM ORDER BY X.LEVEL DESC
SELECT TOP 1 @DIRECT_COUNT_LEVEL=X.LEVEL, @TEAM_SIZE=X.P FROM (
SELECT LEVEL,COUNT(DISTINCT JCODE) AS P,POWER(4,LEVEL) AS QM FROM AMTPAIRDTL WHERE LEVEL<=5 AND MEMB_CODE=@PLACID GROUP BY LEVEL
) AS X WHERE X.P=X.QM ORDER BY X.LEVEL DESC
No comments:
Post a Comment