JCR SQL2 query to find multi-value property with duplicate values? | Community
Skip to main content
Level 2
Sep 26, 2018 1:13 PM UTC
Solved

JCR SQL2 query to find multi-value property with duplicate values?

Is there a way to construct a SQL2 query that would find a multi-value property containing duplicate values?


For instance, we have a multi-value String property called "language". Can a SQL2 query find a node which contains two or more instances of 'en' (English) in the "language" property?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
arunpatidar
arunpatidarAccepted solution
New Participant
Sep 26, 2018 1:50 PM UTC

There is no count(*) or group by selector in JCR SQL , XPath [2] or JCR-SQL2/AQM [3].

So you can't do it with SQL2 query but you can run query like below to find all the nodes with 'en' and then again query each node to check duplicate value using Node API

example -

SELECT * FROM [nt:base] AS s WHERE ISDESCENDANTNODE([/content/AEM63App/fr]) and CONTAINS(s.language, 'en')

Arun Patidar

1 reply

arunpatidar
arunpatidarAccepted solution
New Participant
Sep 26, 2018 1:50 PM UTC

There is no count(*) or group by selector in JCR SQL , XPath [2] or JCR-SQL2/AQM [3].

So you can't do it with SQL2 query but you can run query like below to find all the nodes with 'en' and then again query each node to check duplicate value using Node API

example -

SELECT * FROM [nt:base] AS s WHERE ISDESCENDANTNODE([/content/AEM63App/fr]) and CONTAINS(s.language, 'en')

Translate
Arun Patidar