AS SELECT DISTINCT 
	DDCLElement.Id, 
	DDCLElement.Name, 
	DDCLElement.DdsTypeId, 
	DDCLElementChild.Id AS ChildId, 
	ElementSourceInfo.StartRow AS ElementStartRow, 
	ElementSourceInfo.EndRow AS ElementEndRow, 
	Paths_1.PathStr AS ElementPathStr, 
	CallSourceInfo.StartRow AS CallStartRow, 
	CallSourceInfo.EndRow AS CallEndRow, 
	Paths_2.PathStr AS CallPathStr 
FROM DDCLElement 
	INNER JOIN DDCLValue ON DDCLElement.Id=DDCLValue.ElementId 
	INNER JOIN DDCLProperty ON DDCLValue.PropertyId=DDCLProperty.Id 
	INNER JOIN DDCLElement AS DDCLElementChild ON DDCLValue.ReferenceName=DDCLElementChild.Name 
		AND DDCLValue.ReferenceDdsTypeId=DDCLElementChild.DdsTypeId 
	INNER JOIN DDCLSourceInfo AS ElementSourceInfo ON DDCLElement.SourceInfo=ElementSourceInfo.Id 
	INNER JOIN Programs AS Programs_1 ON ElementSourceInfo.ProgramId=Programs_1.ProgramID 
	INNER JOIN Occurrences AS Occurrences_1 ON Programs_1.OccurID=Occurrences_1.OccurID 
	INNER JOIN Paths AS Paths_1 ON Occurrences_1.PathID=Paths_1.PathID 
	INNER JOIN DDCLSourceInfo AS CallSourceInfo ON DDCLValue.SourceInfo=CallSourceInfo.Id 
	INNER JOIN Programs AS Programs_2 ON CallSourceInfo.ProgramId=Programs_2.ProgramID 
	INNER JOIN Occurrences AS Occurrences_2 ON Programs_2.OccurID=Occurrences_2.OccurID 
	INNER JOIN Paths AS Paths_2 ON Occurrences_2.PathID=Paths_2.PathID 
WHERE (DDCLElement.DdsTypeId IN (24)) 
	AND (DDCLValue.ReferenceDdsTypeId=25) 
	AND (DDCLProperty.Name='APPLICATIONS') 
	AND (DDCLElementChild.Id IN (SELECT * FROM #numeric_param_temp)) 
ORDER BY DDCLElement.Name 