Hello All,
I have a requirement to remove 'order by' on 'created date' and return the results as added in author dialog.
For Instance - Query is
SELECT p.* FROM [cq:PageContent] AS p WHERE ISDESCENDANTNODE(p, [/content/test/en]) AND p.[cq:template] = '/conf/test/settings/wcm/templates/test1' AND ( p.[jcr:path] in ('/content/test/en/second/jcr:content','/content/test/en/first/jcr:content') )
So, expectation is to get results in the same order (as added in query) -
- /content/test/en/second/jcr:content
- /content/test/en/first/jcr:content
whereas, In actual, getting the results like this
- /content/test/en/first/jcr:content
- /content/test/en/second/jcr:content
Any Suggestions ?
Thanks !!
Solved! Go to Solution.
Views
Replies
Total Likes
Hi @srajput-woolies ,
It seems the natural ordering is being applied by default. Is it possible you can apply sorting based on some attribute you are going to fetch from theses nodes as per business requirement?
Another solution is to run the query on each node and then add the result.
Thanks,
Ritesh Mittal
Hi @srajput-woolies ,
It seems the natural ordering is being applied by default. Is it possible you can apply sorting based on some attribute you are going to fetch from theses nodes as per business requirement?
Another solution is to run the query on each node and then add the result.
Thanks,
Ritesh Mittal
What's the exact usecase? Maybe instead of using the JCR_SQL2, you can get the resource of that particular path, and then get childrens of that resource?
Views
Likes
Replies