Hi, I have problem when using pagination with Group BY.
I have two tables: problems : id, title problem replies : problem_id, reply_title Here is hasMany relation between problem and problem replies I am defining pagination in problems_controller problems_controller.php <?php var $paginate = array( 'Problem', 'ProblemReply' => array( 'fields' => array('ProblemReply.problem_id','COUNT (ProblemReply.problem_id) AS count_problem'), 'group' => 'ProblemReply.problem_id', 'order' => array('count_problem' =>'DESC'), 'limit' => 2, 'contain' => array( 'Problem' => array( 'fields' => array('Problem.id', 'Problem.title', 'Problem.description', 'Problem.created'), ) ) ) ); ?> Here Pagination count is not working properly because of GROUP By Pagination count query is : SELECT COUNT(*) AS `count` FROM `problem_replies` AS `ProblemReply` LEFT JOIN `problems` AS `Problem` ON (`ProblemReply`.`problem_id` = `Problem`.`id`) WHERE 1 = 1 GROUP BY `ProblemReply`.`problem_id` I can not use custom query pagination because I am using pagination at many places in problem controller. please tell me how should I solve issue of Group BY in pagination? Thanks --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---