Query to compare items of two users

2010-02-15 Thread blake
First, I brief table structure overview:

titles (id, name, etc)
users (id, name, etc)
titles_users (id, title_id, user_id, metadata)

Is there a good way to use TitlesUser-find() to show all the
different titles between user1 and user2?

I've achieved it through a lot of $dbo-buildStatement functions
(building a query, with subquery for showing what user1 has that user2
doesnt...then doing it again for the other direction and doing a
union)but before I go with this, does anyone know of a more cake
friendly way to do it?

If not, whats the best way for me to go back and paginate the results
of the buildStatements / TitlesUser-query()?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Query to compare items of two users

2010-02-15 Thread Martin Radosta
better than buildStatement for this case I suggest to use expressions. 
This also works with pagination


Hope this helps

MARTIN


On 02/15/2010 02:51 PM, blake wrote:

First, I brief table structure overview:

titles (id, name, etc)
users (id, name, etc)
titles_users (id, title_id, user_id, metadata)

Is there a good way to use TitlesUser-find() to show all the
different titles between user1 and user2?

I've achieved it through a lot of $dbo-buildStatement functions
(building a query, with subquery for showing what user1 has that user2
doesnt...then doing it again for the other direction and doing a
union)but before I go with this, does anyone know of a more cake
friendly way to do it?

If not, whats the best way for me to go back and paginate the results
of the buildStatements / TitlesUser-query()?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
   


Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Query to compare items of two users

2010-02-15 Thread blake
What kind of expressions? Any links you can send me to for details?



On Feb 15, 12:59 pm, Martin Radosta martinrado...@gmail.com wrote:
 better than buildStatement for this case I suggest to use expressions.
 This also works with pagination

 Hope this helps

 MARTIN

 On 02/15/2010 02:51 PM, blake wrote:



  First, I brief table structure overview:

  titles (id, name, etc)
  users (id, name, etc)
  titles_users (id, title_id, user_id, metadata)

  Is there a good way to use TitlesUser-find() to show all the
  different titles between user1 and user2?

  I've achieved it through a lot of $dbo-buildStatement functions
  (building a query, with subquery for showing what user1 has that user2
  doesnt...then doing it again for the other direction and doing a
  union)but before I go with this, does anyone know of a more cake
  friendly way to do it?

  If not, whats the best way for me to go back and paginate the results
  of the buildStatements / TitlesUser-query()?

  Check out the new CakePHP Questions sitehttp://cakeqs.organd help others 
  with their CakePHP related questions.

  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 
  athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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