How to Select Multiple Fields in JCR-SQL2 Query? | Community
Skip to main content
Level 3
May 10, 2023
Solved

How to Select Multiple Fields in JCR-SQL2 Query?

  • May 10, 2023
  • 1 reply
  • 1044 views

How to select multiple fields in a JCR-SQL2 query like such:

 

SELECT page.[jcr:created], page.[jcr:createdBy], page.[jcr:primaryType] FROM [cq:Page] AS page
INNER JOIN [nt:base] AS component ON ISDESCENDANTNODE(component, page)
WHERE component.[sling:resourceType] = '/libs/fd/af/components/aemform'
AND ISDESCENDANTNODE(page, '/content') 

 

 

Currently it is only returning page relative paths, despite I have selected 3 fields in the query: page.[jcr:created], page.[jcr:createdBy], page.[jcr:primaryType].


 

 

 

 

Am I missing something here? 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 BrianKasingli

Here's a query you can use. 

Find me all cq:PageContent nodes, where properties exists: jcr:created, jcr:createdBy, jcr:primaryType

and it must be nodes under the paths of /libs/fd/af/components/aemform or /content

 

SELECT page.* FROM [cq:PageContent] AS page WHERE page.[jcr:created] IS NOT NULL AND page.[jcr:createdBy] IS NOT NULL AND page.[jcr:primaryType] IS NOT NULL AND (ISDESCENDANTNODE(page,'/libs/fd/af/components/aemform') OR ISDESCENDANTNODE(page,'/content'))

 

 

1 reply

BrianKasingli
Community Advisor and Adobe Champion
BrianKasingliCommunity Advisor and Adobe ChampionAccepted solution
Community Advisor and Adobe Champion
May 11, 2023

Here's a query you can use. 

Find me all cq:PageContent nodes, where properties exists: jcr:created, jcr:createdBy, jcr:primaryType

and it must be nodes under the paths of /libs/fd/af/components/aemform or /content

 

SELECT page.* FROM [cq:PageContent] AS page WHERE page.[jcr:created] IS NOT NULL AND page.[jcr:createdBy] IS NOT NULL AND page.[jcr:primaryType] IS NOT NULL AND (ISDESCENDANTNODE(page,'/libs/fd/af/components/aemform') OR ISDESCENDANTNODE(page,'/content'))