This is a simple relationship, I think your missing something.

$this->find('list', array('fields'=>array
('Site.id','Site.title'),'conditions'=>array('SiteUser.id=1'))

THis will require the recursive attribute to be 0 or higher I think.

On Nov 23, 12:03 am, pkclarke <[EMAIL PROTECTED]> wrote:
> I have the following tables:
>
> sites
>  - id
>  - title
>
> site_users
>  - id
>  - site_id
>  - user_id
>
> How do I construct a "find()" to retrieve equivalent of the following
> query:
>
> SELECT a.id, a.title FROM sites a, site_users b WHERE a.id = b.site_id
> AND b.user_id = 1;
>
> I tried "find('list', array('fields'=>array('SiteUser.site_id',
> 'SiteUser.Site.title')))" but nothing is that easy ;-)
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to