Add DISTINCT to SELECT query when using together()

Hi!

Is there a way to add a DISTINCT to a find() query when using with()->together() combination?

The problem is that together() generates one query but can result in duplicate records being selected. In case I'm using CPagination class this can bring a problem when LIMIT is applied, e.g. it will result in 10 first records to be returned by database, some of them are duplicates which are then removed by Yii and as result of find() I get less then 10 records.

I can add a GROUP BY ??.id manually of course, but if together() will do that automatically would be much better :)

Bump this thread!!! I have the same issue with together and duplicate records… Is there any good solution to avoid this problem??

Thanks

Alex

By the moment I have solved with your solution:

using


 'group' => '`t`.record_id',

in criteria.

thanks oleksy,

alex