Ok, if you cannot modify the database tables, then the other option is to 
use sub-queries, see the CakePHP book at:
http://book.cakephp.org/2.0/en/models/retrieving-your-data.html#sub-queries

My understanding of this, is that you first construct the SQL statement for 
finding all the parent ids in the child table, then uses that SQL statement 
as a condition for finding all parent records with the id not being found 
by the previous SQL statement.

Hope that helps you out :)
Enjoy, John

On Monday, 17 November 2014 06:05:48 UTC+2, Kento Furui wrote:
>
> Thank you John.
>
> counterCache seems to be a good idea. 
> But there must be a way to do this *without adding a column* to an 
> existing table.
> [snip]
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

Reply via email to