Expand my Community achievements bar.

Join us in celebrating the outstanding achievement of our AEM Community Member of the Year!
SOLVED

JCR query with condition on child node's property value

Avatar

Level 7

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.

1 Accepted Solution

Avatar

Correct answer by
Level 10

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)

View solution in original post

2 Replies

Avatar

Correct answer by
Level 10

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)

Avatar

Level 9

Have you tried @domainName like

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