コミュニティアチーブメントバーを展開する。

Submissions are now open for the 2026 Adobe Experience Maker Awards.

Mark Solution

この会話は、活動がないためロックされています。新しい投稿を作成してください。

解決済み

SQL2 Query

Avatar

Level 1

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 !!

1 受け入れられたソリューション

Avatar

正解者
Community Advisor and Adobe Champion

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

元の投稿で解決策を見る

2 返信

Avatar

正解者
Community Advisor and Adobe Champion

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

Avatar

Community Advisor and Adobe Champion

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?