I have a Model User, and another Model Friend. in the Friend Model, I
have 2 foreign keys user_id and friend_id, both points to the same
User Model.  in this design, all the operations on Friend Model
doesn't work, find, delete.....

The error is like this:

SQL Error: 1066: Not unique table/alias: 'Friend'

Query: SELECT `Friend`.`user_id`, `Friend`.`friend_id`, `Friend`.`id`
FROM `friends` AS `Friend` LEFT JOIN `users` AS `User` ON
(`Friend`.`user_id` = `User`.`id`) LEFT JOIN `friends` AS `Friend` ON
(`Friend`.`friend_id` = `Friend`.`id`)  WHERE `Friend`.`id` = 9
LIMIT 1

The  problem is `Friend`.`friend_id` is left joined with
`Friend`.`id`. How to solve this problem ?

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