Probably a dumb question, but did you try a NOT condition on your
find?
array ("not" => array (
"Invitation.id" => null,
)
)
http://book.cakephp.org/view/74/Complex-Find-Conditions
On Dec 18, 10:58 am, Ramiro Araujo <[email protected]> wrote:
> Hi all
>
> I wasn't really fond to the find method before, and made a lot of
> custom query()ies. Now im using it a lot, with quite nice results.
>
> Still, im having trouble trying to build a query. Let me explain the
> situation.
> I have 2 tables: a users table, and a invitations table. User hasMany
> Invitation and Invitation belongsTo User, right?
> I want to get, in one shot, the folowing: All the users that DIDN'T
> invite anyone, so all the users that are not present in the
> invitations table (by user_id).
> The query for this is:
>
> SELECT u.*
> FROM users u LEFT JOIN invitations i
> ON u.id = i.user_id
> WHERE i.id IS NOT NULL
> GROUP BY u.id
>
> Is there a way of doing the same query in cake? keep in mind I want
> the data returned like this, not a bigger return, and a Set::extract
> or something. This tables could be really really huge.
>
> Thank
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---