the main SQL code (from phpMyAdmin - works fine)
SELECT *
FROM `users`
ORDER BY id >=2 DESC , id ASC
LIMIT 0 , 30
cakified (gives an error)
$users_list = $this->User->find('all', array('order' =>"(User.id>=2)
DESC, User.id ASC"));
Error shown:
SQL Error: 1064: You have an error in your SQL syntax; check the
manual that corresponds to your MySQL server version for the right
syntax to use near 'User`.`id`>=2)` DESC, `User`.`id` ASC' at line 1
[CORE\cake\libs\model\datasources\dbo_source.php, line 501]
as far as it seems to me, the problem is in the SQL code generated by
cake.
this is what it generates currently (with an error):
...... ORDER BY User`.`id` >= 2 DESC, `User`.`id` ASC
note that, there is a ` missing before User (right after ORDER BY)
it should be like this (correct one):
...... ORDER BY `User`.`id` >= 2 DESC, `User`.`id` ASC
now how do i get it done in cake? :S
the original post was here:
http://groups.google.com/group/cake-php/browse_thread/thread/4840698330aa4565#
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" 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
-~----------~----~----~----~------~----~------~--~---