JCR query with condition on child node's property value | Community
Skip to main content
LinearGradient
Level 6
October 16, 2015
Solved

JCR query with condition on child node's property value

  • October 16, 2015
  • 2 replies
  • 4424 views

Hi,

Is there a way to write this query without using joins or sub queries using SQL2?

SELECT * FROM [cq:Page]
WHERE ISDESCENDANTNODE(['/content/myapp'])
AND LOCALNAME = 'home'
AND ['jcr:content/domainName'] = 'example.com'

The query in English is "Find all cq:Page nodes that are named home and have a child node jcr:content that has a property domainName with value example.com".

At the moment, the problem is that I cannot use jcr:content/domainName as a property name in the where clause.

Thanks.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Lokesh_Shivalingaiah

You can also refer [1]

http://docs.adobe.com/docs/en/aem/6-0/develop/search/querybuilder-api.html 

and test it on query builder (/libs/cq/search/content/querydebug.html)

2 replies

Lokesh_Shivalingaiah
Lokesh_ShivalingaiahAccepted solution
Level 10
October 16, 2015

You can also refer [1]

http://docs.adobe.com/docs/en/aem/6-0/develop/search/querybuilder-api.html 

and test it on query builder (/libs/cq/search/content/querydebug.html)

Community Advisor
October 16, 2015

Have you tried @domainName like

SELECT * FROM [cq:Page]
WHERE ISDESCENDANTNODE(['/content/myapp'])
AND LOCALNAME = 'home'
AND ['jcr:content/@domainName'] = 'example.com'