1

I've faced with a duplicate rows issue when I use JCR-SQl2 query for getting data in AEM 6.3.1. I attached the SQl2 query below.

SELECT s.* FROM [rep:User] AS s
LEFT OUTER JOIN [nt:base] AS c ON
ischildnode(c, s)
WHERE (ISDESCENDANTNODE(s,"/home/users"))
and s.[rep:authorizableId] = {0} or c.[email] = {0}

Is there a way to use "Select DISTINCT" statement in JCR-SQL2 query or something like that for removing the duplicate rows of result.

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
Mike
  • 11
  • 3
  • Not sure if that is possible. One way to solve this is to add the results to a Set to remove duplicates. I tried your query on our instance and always only get one result? Not 100% sure what you try to achieve and how you get duplicates. Maybe you can expand a bit on what you are trying to do and give us some sample data? – Jens Mar 27 '19 at 10:33
  • Thank you for your support, Jens. About the issue, when we use the query tool of AEM, it always returns only one row, but when I use the jcr API (javax.jcr.query.Query) then I always receive the result of the duplicate rows. Currently, my issue's fixing by a solution like your suggestion, but I was not comfortable with this. – Mike Apr 27 '19 at 05:36

0 Answers0