AS SELECT DISTINCT TOP 100 PERCENT Statements.Description, Paths.PathStr, OccurrencesStmt.StartRow, ProgramTypes.ProgramType
FROM (((StatementReference INNER JOIN OccurrencesStmt ON StatementReference.OccurID = OccurrencesStmt.OccurID) INNER JOIN Statements ON StatementReference.StatementType = Statements.StatementType) INNER JOIN Paths ON OccurrencesStmt.PathID = Paths.PathID) INNER JOIN (Programs INNER JOIN ProgramTypes ON Programs.ProgramTypeID = ProgramTypes.ProgramTypeID) ON OccurrencesStmt.ProgID = Programs.ProgramID
WHERE ( StatementReference.ResourceID IN (select ProgramID from #numeric_param_temp) )
		AND ( StatementReference.ResourceType = 4 OR StatementReference.ResourceType = 97 ) 
GROUP BY Paths.PathStr, OccurrencesStmt.StartRow, Statements.Description, ProgramTypes.ProgramType
ORDER BY Paths.PathStr, OccurrencesStmt.StartRow, Statements.Description