Maurice Wright Wed Jan 19 20:32:07 -0500 2011

Subject: Sub Queries

I'm trying to build a query using a nested select statement. The below usage seems to ignore the condition. The User object references a table called 'user'. The subquery references a separate 'friends' table. Any help would be appreciated.

$no_relationships = User::find('all', 
'order' => 'name',
'conditions' => "id not in (select distinct(other_user_id)
from friends
where user_id = '.$this->id.')"


Kien La Fri Jan 21 22:45:43 -0500 2011

I don't see anything wrong with that syntax. It should be working. Are you sure the query with the specified id actually returns results?