I need to merge these 2 queries together:
Query 1
SELECT page.* FROM [cq:Page] AS page INNER JOIN [nt:base] AS component ON isdescendantnode(component,page) WHERE component.[sling:resourceType] ='wcm/foundation/components/responsivegrid'
This query returns all pages that have the component of resource type wcm/foundation/components/responsivegrid
Query 2
SELECT * FROM [nt:base] AS s WHERE ISDESCENDANTNODE([/content/en-us/homepage/jcr:content])
This query returns all components under jcr:content
that the page path with "/content/en-us/homepage"
I would like to use the list of page urls from from query 1 and apply on query 2 and replace this path "/content/en-us/homepage".
Here's what I have but it shows an error of expected: static operand
:
SELECT * FROM [nt:base] AS s WHERE s.[sling:resourceType] ='wcm/foundation/components/responsivegrid' AND s.[jcr:path] IN ( SELECT page.[jcr:path] FROM [cq:Page] AS page INNER JOIN [nt:base] AS component ON isdescendantnode(component, page) WHERE component.[sling:resourceType] ='wcm/foundation/components/responsivegrid' )
What should be the right syntax in JCR-SQL2?