You can either change the order parameter in the model definition or
use a beforeFind in the model to change the order.
On May 17, 12:48 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> Here is the debug from my query using
>
> $this->set('data', $this->Question->findAll('quiz_id = '.$quiz_id,
> NULL, '(Question.id) ASC', NULL, 1, 1));
>
> ///////////////////////////////////////////////////////////////////////////////////////////////
>
> 1 DESC `quizzes` 10 10 1
> 2 DESC `questions` 8 8 0
> 3 DESC `answers` 6 6 0
> 4 SELECT `Question`.`id`, `Question`.`created`, `Question`.`updated`,
> `Question`.`active`, `Question`.`quiz_id`, `Question`.`question`,
> `Question`.`type`, `Question`.`weight`, `Quiz`.`id`, `Quiz`.`created`,
> `Quiz`.`updated`, `Quiz`.`instructions`, `Quiz`.`name`,
> `Quiz`.`description`, `Quiz`.`passwordRequired`, `Quiz`.`password`,
> `Quiz`.`timedQuiz`, `Quiz`.`maxTime` FROM `questions` AS `Question`
> LEFT JOIN `quizzes` AS `Quiz` ON (`Question`.`quiz_id` = `Quiz`.`id`)
> WHERE quiz_id = 5 ORDER BY (`Question`.`id`) ASC 2 2
> 0
> 5 SELECT `Answer`.`id`, `Answer`.`question_id`, `Answer`.`created`,
> `Answer`.`updated`, `Answer`.`answer`, `Answer`.`correct` FROM
> `answers` AS `Answer` WHERE `Answer`.`question_id` = 9 ORDER BY
> `Answer`.`id` DESC 2 2 0
> 6 SELECT `Answer`.`id`, `Answer`.`question_id`, `Answer`.`created`,
> `Answer`.`updated`, `Answer`.`answer`, `Answer`.`correct` FROM
> `answers` AS `Answer` WHERE `Answer`.`question_id` = 10 ORDER BY
> `Answer`.`id` DESC
>
> ///////////////////////////////////////////////////////////////////////////////////////////////
>
> The problem is if you see query #5 i want to be able to specify the
> order on that as well so I tried
>
> $this->set('data', $this->Question->findAll('quiz_id = '.$quiz_id,
> NULL, '(Question.id / Answer.id) ASC', NULL, 1, 1));
>
> That results in an error because it applies to to query #4. How can I
> put a sort order on query #5??
>
> ///////////////////////////////////////////////////////////////////////////////////////////////
> 1 DESC `quizzes` 10 10 1
> 2 DESC `questions` 8 8 1
> 3 DESC `answers` 6 6 1
> 4 SELECT `Question`.`id`, `Question`.`created`, `Question`.`updated`,
> `Question`.`active`, `Question`.`quiz_id`, `Question`.`question`,
> `Question`.`type`, `Question`.`weight`, `Quiz`.`id`, `Quiz`.`created`,
> `Quiz`.`updated`, `Quiz`.`instructions`, `Quiz`.`name`,
> `Quiz`.`description`, `Quiz`.`passwordRequired`, `Quiz`.`password`,
> `Quiz`.`timedQuiz`, `Quiz`.`maxTime` FROM `questions` AS `Question`
> LEFT JOIN `quizzes` AS `Quiz` ON (`Question`.`quiz_id` = `Quiz`.`id`)
> WHERE quiz_id = 5 ORDER BY (`Question`.`id`) ASC, `Answer`.`Id` ASC
> 1109: Unknown table 'Answer' in order clause 1
> 5 onerror
>
> ///////////////////////////////////////////////////////////////////////////////////////////////
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---