Hi guys, I was wondering if is possible to get distinct values with a query built with the model criteria.
Follow an example (PS.: don't bother with the lack of the bind parameter, it was just a test):
In this case, when I have 1 user that already lived on a city A (id=1) and on a city B (id=2) I will get the user twice (or more, that depends on how many cities he lived).
I know that it's caused because of the intermediate table called lived, and I get the same problem creating "raw queries". But in raw queries I can add the DISTINCT clause and I couldn't find how to do that with the Criteria class.
PS.: I know that if I use the query builder I can set distinct(true) and my problem is solved, but my question is exactly on how to use distinct with Criteria and not with the QueryBuilder.
Regards and apologies about the bad english.