Hey Paul, Just wanted to update you. I could never get it working. Tried the examples above and couldn't come up with anything.
Finally got back to it today and just added an if clause to the view to filter out result that had that parameter. Not sure if it is the best but it is working well. Thanks for all of your help. I did learn a lot along the way so it wasn't in vein I assure you. Brad On May 31, 3:33 am, WebbedIT <[email protected]> wrote: > Your double join on the same table is fine, I just didn't notice it. > > Can you try this instead? > > SELECT DISTINCT User.id, User.username FROM users AS User > LEFT JOIN friends AS Friend ON (User.id = Friend.user_id AND > Friend.approved IN(0,1)) > LEFT JOIN friends AS Admirer ON (User.id = Admirer.friend_id AND > Admirer.approved IN(0,1)) > > Does this give the desired results where the Friend count is the > amount of records where friends.user_id matches the current user and > the Admirer count is the number of friends where friends.friend_id > matches the current users. > > If this works and pulls the data you are sure it should pull then we > simply need to force some joins in Cake using: > > http://book.cakephp.org/view/86/Creating-and-Destroying-Associations-... > > or > > http://book.cakephp.org/view/872/Joining-tables > > HTH > > Paul 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 [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
