Hello everybody! I need some help about construction of a subquery. I have 2 classes: "projects" and "steps". Also, name of a projectclass pages - is one of a property of a class "step" (for this reason, If I know project, I can find all steps of this project). I have one query: #set ($hql = ", BaseObject as obj, StringProperty as prop where (obj.name=doc.fullName and obj.className='UAProjectManagementCode.ProjectClass' and obj.name not like '%ClassTemplate') and (obj.id=prop.id.id and prop.id.name='ProjectName') order by prop.value asc ") This query returns all projects. After this, I use #foreach ($proj in $projs) #set ($projDoc = $xwiki.getDocument($proj)) #set ($projName = $projDoc.getName()) ... And, each time, for each project, I use second query, with additional filter by $projName: #set ($hql2 = ", BaseObject as obj, StringProperty as prop, StringProperty as otherprop where (obj.name=doc.fullName and obj.className='UAProjectManagementCode.StepClass' and obj.name not like '%ClassTemplate') and (obj.id=prop.id.id and prop.id.name='Project' and prop.value='$projName') and (obj.id=otherprop.id.id and otherprop.id.name='Step') order by prop.value asc, otherprop.value asc ") Together, this construction returns to me list of all projects with all params, and for each project - list of all steps with all params. This construction works normal, but I know, that HQL give possibility to use subqueries. It is a best variant, because now 2-nd query runs for each project. If projects will be much more - speed will go down ... In a page with HQL examples (http://platform.xwiki.org/xwiki/bin/view/DevGuide/velocityHqlExamples) unfortunately not exist any examples about subqueries in a XWiki. Can somebody help me? Thanks beforehand! Eugen Colesnicov -- View this message in context: http://xwiki.475771.n2.nabble.com/using-subqueries-in-HQL-tp5069488p5069488.... Sent from the XWiki- Users mailing list archive at Nabble.com.