Thursday, 2 January 2020

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

No comments:

Post a Comment