JCR SQL2 Query - find the parent nodes that do not contain children of a type
The structure i have is a@b.com/yyyy/mm/dd format with nt:unstructured nodes under the date node.
I am trying to get the path at date level which in our case is "25" in case-2 and "15" in case-1, and get "15" since it has no nt:unstructured nodes under it.
What i get is:
Case 1 & case 2 responses:
path to node year node- 2021, path to date node -15 and path to month node -3
Please let me know if I am missing something.
Query
SELECT folder.* FROM [sling:Folder] AS folder
LEFT OUTER JOIN [nt:unstructured] AS childnode ON ISCHILDNODE(childnode, folder)
WHERE ISDESCENDANTNODE(folder, "/var/test/links/a@b.com")
AND childnode.[jcr:primaryType] IS NULL
AND childnode.[sling:resourceType] IS NULL
case1- no nt:unstructured node under node "15"
|____2021 ( sling:Folder)
|____03 ( sling:Folder)
|___15 ( sling:Folder)
case2- nt:unstructured node under node "25"
|____2022 ( sling:Folder)
|____04 ( sling:Folder)
|___25 ( sling:Folder)
|____nt:unstructured, sling:resourceType = "sling/collection"
|______________________sling:members(nt:unstructured)
|_________test.jpg(nt:unstructured)