SQL2 Query to get all All AEM Assets having width greater than a given value | Community
Skip to main content
New Participant
December 14, 2023
Solved

SQL2 Query to get all All AEM Assets having width greater than a given value

  • December 14, 2023
  • 1 reply
  • 590 views

I have one requirement to write a query to get all the AEM Assets having width greater than a given value.

I tried to write the following SQL2 Query but it did not work.

 

SELECT asset.* FROM [dam:Asset] AS asset INNER JOIN [nt:unstructured] AS metadataNode ON ISCHILDNODE(metadataNode, asset) WHERE ISDESCENDANTNODE(asset, "/content/dam/wknd-shared") AND metadataNode.[jcr:content/metadata/tiff:ImageWidth] >= CAST("1600" AS LONG)

 

Please help me to write this query which return the expected response.

 

@aanchal-sikka @arunpatidar @kautuk_sahni 

@estebanbustamante @sudheer_sundalam @joerghoh 

@lukasz-m @rohan_garg @sady_rifat 

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 lukasz-m

Hi @s__k__agarwal,

I am not sure why your query is so complex. Below works for me, hope this will solve your problem.

SELECT * FROM [dam:Asset] AS a WHERE ISDESCENDANTNODE([/content/dam/wknd-shared]) AND a.[jcr:content/metadata/tiff:ImageWidth] >= CAST("1600" AS LONG)

or

SELECT * FROM [dam:Asset] AS a WHERE ISDESCENDANTNODE([/content/dam/wknd-shared]) AND PROPERTY(a.[jcr:content/metadata/tiff:ImageWidth], "LONG") >= "1600"

1 reply

lukasz-m
lukasz-mAccepted solution
New Participant
December 14, 2023

Hi @s__k__agarwal,

I am not sure why your query is so complex. Below works for me, hope this will solve your problem.

SELECT * FROM [dam:Asset] AS a WHERE ISDESCENDANTNODE([/content/dam/wknd-shared]) AND a.[jcr:content/metadata/tiff:ImageWidth] >= CAST("1600" AS LONG)

or

SELECT * FROM [dam:Asset] AS a WHERE ISDESCENDANTNODE([/content/dam/wknd-shared]) AND PROPERTY(a.[jcr:content/metadata/tiff:ImageWidth], "LONG") >= "1600"