AS SELECT DDCLElement.Name, DDCLVAlue.ReferenceName, count(DDCLVAlue.ReferenceName), DDCLElement.DdsTypeId 
FROM DDCLValue JOIN DDCLProperty ON DDCLValue.PropertyId=DDCLProperty.id join DDCLElement ON DDCLProperty.ElementId=DDCLElement.Id 
where DDCLValue.ReferenceDdsTypeId=14 
	 AND DDCLValue.ValueTypeId in (2,4)
	 AND DDCLElement.DdsTypeId IN (11, 16, 26) 
	 AND (DDCLProperty.Name='DISPLAY-STRUCTURE' OR DDCLProperty.Name='PRINT-FORM')
group by DDCLElement.Name, DDCLVAlue.ReferenceName, DDCLElement.DdsTypeId
order by DDCLElement.Name, DDCLVAlue.ReferenceName