select DocAscii, Min(docID) MinDocID, Max(docID) MaxDocID, Count(*) From Documents where DocID IN(
select DocID  
from vefn_GetVersionNames() VN
Join vefn_GetVersionItems('') VI ON VI.VersionID = VN.VersionID
Join
(
select EE.ContentID, DD.DocID, Max(len(DocAscii)-len(Replace(DocAscii,'<',''))) ROs, Count(DR.DocID) HowMany from Documents DD
join Entries EE ON EE.DocID = DD.DocID
left JOIN DROUsages DR ON DR.DocID = DD.DocID
where DocAscii not like '%<<G%' and DocAscii not like '%< %' 
Group By EE.ContentID, DD.DocID
) T1 ON T1.ContentID = VI.ContentID
where T1.ROs != T1.HowMany)
Group By DocAscii