I need to run this query in $this->paginate(). 99 is an arbitrary user
id number that is externally provided.

I read this, http:book.cakephp.org/view/249/Custom-Query-Pagination,
but it didn't help. I did also read this http:www.littlehart.net/
atthekeyboard/2008/03/04/custom-cakephp-12-pagination-queries/, and
other similar posts, but they won't work for me. Because in my
controller I only need this custom pagination for a single action, all
other actions of the same controller work with default cakephp
settings. IF I override paginate() then I'll end up messing up my
other actions - because I will also need to override paginateCount()
with my custom sql, something that will make my pagination in other
actions useless. I love cake, but stuff like this sometimes makes you
frustrated.. why they didn't provide such a basic functionality. I
also couldn't find in the book.cakephp.org a way of how to create
Union queries. go figure.

What do you suggest i do?

SELECT *
FROM users
WHERE users.id
IN (
SELECT friends.friend_id AS id
FROM friends
WHERE friends.user_id =99
AND friends.status =1
UNION
SELECT friends.user_id AS id
FROM friends
WHERE friends.friend_id =99
AND friends.status =1
)

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to