[AEM6.5] JCR SQL2 Query to fetch the count of node under a component
Hi Team,
I am trying to write a JCR SQL2 query in AEM 6.5 to get the list of all pages of template /conf/migration/settings/wcm/templates/taxonomy-template which is having more than 1000+ nodes under it.
The scenario i have multiple pages under /content/project.
There are few pages which belongs to /conf/migration/settings/wcm/templates/taxonomy-template
Example: /content/project/page1 And it has multifeild components called as taxonomy which stores the multiple values in different nodes And the structure is like /content/project/us/en/about-us/jcr:content/root/container/taxonomy/codesection.
And inside this we have long list of node.

Now I want to fetch the list of all pages under path /content/project with template type /conf/migration/settings/wcm/templates/taxonomy-template and the nodes will be more than 1000+ under componet
*/jcr:content/root/container/taxonomy/codesection/
I am trying to do in a way like:
SELECT * FROM [nt:base] AS page
WHERE ISDESCENDANTNODE(page, '/content/project')
AND page.[jcr:content/cq:template] = '/conf/migration/settings/wcm/templates/taxonomy-template'
AND (SELECT COUNT(*) FROM [nt:base] AS nodes WHERE ISDESCENDANTNODE(nodes, page) AND NAME(nodes) = 'codesection') > 1000But while running it throws ParseException.
Can anyone please guide how to achive the list of pages have more than 1000+ nodes under a single components in page.
Thanks