SQL2 - Query for nodes without specific child node | Community
Skip to main content
Level 3
December 2, 2016

SQL2 - Query for nodes without specific child node

  • December 2, 2016
  • 0 replies
  • 3581 views

AEM 6.2...

I would like to identify nodes in the DAM which may have been missed by a disabled DAM Update Asset workflow.  These nodes would be missing a child metadata and/or renditions.

Executing the following two queries returns identical results:

1) SELECT * FROM [dam:Asset] AS s WHERE ISDESCENDANTNODE([/content/dam/])

2) SELECT * FROM [dam:Asset] AS s WHERE ISDESCENDANTNODE([/content/dam/]) and [jcr:content/metadata] is null

The null check does not appear to be respected.

The following query returns the inverse of what I would like to see.  It returns only nodes which DO have a metadata child node:

SELECT parent.* 
FROM [dam:Asset] as parent 
INNER JOIN  [nt:unstructured] AS child ON ISDESCENDANTNODE(child,parent) 
WHERE ISDESCENDANTNODE(child,[/content/dam]) and name(child) = 'metadata'

I can achieve this with some java code... but I'd like to understand why this query does not work as expected.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.