It appears that JCR-SQL2 which supports DISTINCT is not used at this time. I am curious if it will be in the future to allow the use of DISTINCT. Have you posed the question to support to see if they have any suggestions?
You could specify a folder path (if you are able)…That way at least only one item will show up. We currently have a bug (tech support is following up on this) where even after specifying the folder path, the link to the wrong item (item in the other folder) is generated.
This also brings up a point as to which item you want the link to point to…
Thanks for your suggestions.
Support’s response was to either further refine the query as jtendra suggested or to determine the uniqueness in the Velocity template itself.
We’ll probably look at the latter.