Saturday, December 27, 2008

How would I write this query

Im a bit new to the model system, trying to understand how I would do
a query like so.

SELECT Friend.*, User.username, User.avatar, User.handler FROM friends
AS Friend, users AS User WHERE Friend.status = 'approved' AND
((user_id = ':user_id') OR (friend_id = ':user_id')) AND User.id =
Friend.user_id ORDER BY Friend.requestTime ASC LIMIT 0,5

It would also need pagination. It works similar to myspace/facebook
etc friend lists.
--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: