AS SELECT DDCLElement.name as Application, DDCLValue.referencename as ElemName, 
             count (DDCLProperty.name) as no, DDCLElement.DdsTypeId
from DDCLElement join DDCLProperty on DDCLElement.id = DDCLProperty.elementid
	 join DDCLValue on DDCLProperty.id=DDCLValue.propertyid
where DDCLElement.DdsTypeId in (25) and DDCLElement.islocal='false'
	 and DDCLValue.referenceddstypeid =26
	 AND DDCLValue.ValueTypeId in (2,4)
	 AND DDCLProperty.name = 'DIALOGUES'
group by DDCLElement.name , DDCLValue.referencename, DDCLElement.DdsTypeId 
order by DDCLElement.name , DDCLValue.referencename
