Allright,
I;ve been cracking my head on this.

I have a HABTM relation between users and products. Users can select a
product to put on his favorite list. Everything works great (A lot of
thanks to this Googlegroups for that!) but now I need something heavy.

So I have a users table, products table and the HABTM table with
user_id and product_id. From this table I can get, using Containable
behaviour) the products belonging to a certain user.

Now I want to match the lists of two users together. So using two id's
from two different users, I need to get a list of products from the
table that occur in both users list.

So:
User1       User2
Product1  Product2
Product3  Product3
Product5  Product6
Product6

Needs to return an array containing Product 3 and product 6. I've been
reading and re-reading containable behaviour and the internet, and
though about getting both lists from the database and just use a PHP
query to match. Is there an easy solution, or do you recommend using
PHP instead of SQL for this, timewise?

Thanks a million!


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to