AS SELECT DISTINCT  
		Variables_1.VarID, 
		Variables_2.VarID AS DataDependantVarId, 
		Statements.Description AS StatementType, 
		ProgramAliases.AliasName AS ProgramName, 
        Paths.PathStr, 
        OccurrencesStmt.StartRow,
        Variables_2.IsField,
        Variables_1.Varsize,
        Variables_2.Varsize,
        Variables_1.Type,
        Variables_2.Type 
FROM    Variables Variables_2 INNER JOIN
			(
	        	 (	(Paths INNER JOIN
	        			(
		        			(Statements INNER JOIN
		        			OccurrencesStmt ON Statements.StatementType = OccurrencesStmt.StatementType
		        			) INNER JOIN
	        			ProgramAliases ON OccurrencesStmt.ProgID = ProgramAliases.ProgramID and ProgramAliases.AliasType = 0
	        			) 
	        			ON Paths.PathID = OccurrencesStmt.PathID
	        		)
	        		INNER JOIN
				        (StatementReference StatementReference_1 INNER JOIN
				        Variables Variables_1 ON StatementReference_1.ResourceID = Variables_1.VarID) 
				    ON OccurrencesStmt.OccurID = StatementReference_1.OccurID
				  )
			 INNER JOIN
        		StatementReference StatementReference_2 ON StatementReference_1.OccurID = StatementReference_2.OccurID 
        		AND (
        		ROUND(StatementReference_1.bRead/2,0)*2 = ROUND(StatementReference_2.bRead/2,0)*2
        		AND (StatementReference_1.bRead <> StatementReference_2.bRead)
        		AND (StatementReference_1.bRead > 0) 
				AND (StatementReference_2.bRead > 0)
        		)
       		) 
        ON Variables_2.VarID = StatementReference_2.ResourceID
WHERE     	(StatementReference_1.ResourceType = 4) 
			AND (StatementReference_2.ResourceType = 4) 
			AND (Variables_1.VarID IN (Select * from #numeric_param_temp)) 
			AND (StatementReference_1.StatementType IN (14, 18, 23, 30, 326, 412)) 
			AND (StatementReference_1.bRead > 3) 
			AND (StatementReference_2.bRead > 3)
ORDER BY Variables_2.VarID


