Andy, thank you for your input! Okay now I feel like a total **rk for asking something that has been a) explained so well in a discussion and b) stuck in the frequent discussion page :) The thing is I've actually read that specific discussion (plus a bunch of other threads/articles), but because I also read that specific thread back half an year ago when searching for a solution to a different problem - the trivial filtering of HABTM model - I haven't paid attention to the extra info on how to setup multiple joins. This time I just browsed the first couple of lines and thought that I recalled the discussion and it wouldn't help me as it was regarding a different matter :)
Regarding the DISTINCT operator in fields - I tried setting the fields in $paginate as follows: $this->paginate['User'] = array( 'limit' => 3, 'page' => 1, 'order' => array('User.id' => 'desc'), 'fields' => array( 'DISTINCT User.id', 'User.*', ) ); Then, when setting an 'OR' type restriction (HabtmModel.foreign_key_id => array(id_1, id_2)), I'm getting the correct records, but wrong data in the counter: For example if 5 users match the restrictions, and one of them is associated with both habtm foreign keys I'm getting 5 records as per the DISTINCT operator, but the counter navigation is showing 6 records: View 1 - 3 of 6 3 records listed View 4 - 6 of 6 2 records listed Examining the SQL shows that the DISTINCT operator is not applied the COUNT(*) MySQL query: SELECT COUNT(*) AS `count` FROM `users` AS `User` LEFT JOIN `groups` AS `Group` ON ... SELECT DISTINCT `User`.`id`, `User`.*, `User`.`id` FROM `users` AS `User` LEFT JOIN `groups` AS `Group` ON... Is there a workaround for this inconsistence? On 11 Фев, 10:55, AD7six <[EMAIL PROTECTED]> wrote: > you can specify fields in var $paginate > http://groups.google.com/group/cake-php/web/frequent-discussions > (filtering HABTM data (once more)) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---