Quantcast
Channel: Adobe Community: Message List
Viewing all articles
Browse latest Browse all 90000

Re: SQL2 | How to add condition on multi-value field?

$
0
0

Hi,

 

Below is an example of SQL2 query based on your scenario. you can modify and use it

 

SELECT * FROM [nt:base] AS s WHERE ISDESCENDANTNODE([/content/geometrixx/en]) and (CONTAINS(s.[cq:tags], 'mynspace:mytag') or CONTAINS(s.[cq:tags], 'mynspace:mytagss1'))

 

where root node path  and tags value you can change as per your need. Below is java formation

 

StringBuilder query = new StringBuilder();

query.append("SELECT * FROM [nt:base] AS s WHERE ISDESCENDANTNODE([")

.append(pathToYourPageArea)   //for example /content/geometrixx/en

.append("]) AND (CONTAINS(s.[cq:tags],'mynspace:mytag') or CONTAINS(s.[cq:tags],'mynspace:mytagss1'))");

Query compiledQuery = queryManager.createQuery(query.toString(), Query.JCR_SQL2);

 

where 'mynspace:mytag' and 'mynspace:mytagss1' is an example and you can change it with variables

 

I hope it will help you to proceed. Let me know if you need more information.

 

 

Thanks,

Pawan


Viewing all articles
Browse latest Browse all 90000

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>