Use OuterQuery Column in Subquery
===

Hi I am doing a subquery to get value of cTL column But i need value of outer column in the subquery for right response
but i get error that it doesn't recognize the SC and RC varaibles. ANy way out?

    SELECT DISTINCT(cStoreCode) as SC,cRetailerCode as RC, cStoreCode + ' - ' + cStoreName AS Store,
    	x.TeamLead FROM
    	(
    	SELECT cTL as TeamLead FROM tblEmpSchedule WHERE
    	cRepCode LIKE @repCode AND
    		cClientCode LIKE @gCode AND
    		cProjectCode LIKE @pCode AND
    		cYear LIKE @year AND
    		cCycleNo LIKE @cycleNo AND
    		cRetailerCode LIKE @retailerCode AND
    		cStoreCode = SC AND
    		cRetailerCode = RC
    		)x
    	,tblEmpSchedule 
    	WHERE
    		cRepCode LIKE @repCode AND
    		cClientCode LIKE @gCode AND
    		cProjectCode LIKE @pCode AND
    		cYear LIKE @year AND
    		cCycleNo LIKE @cycleNo AND
    		cRetailerCode LIKE @retailerCode AND
    		cStoreCode <> '' AND cStoreCode is Not Null
    	ORDER BY 
    		cStoreCode