Thursday, January 23, 2014

Re: Adding a new counter cache

No .. It will only run through the table once updating all records.

On 23 Jan 2014 12:34, "Aurelian Apostol" <aurelian.apostol@gmail.com> wrote:
Wouldn't this run an infinte loop? It needs a further WHERE clause maybe where model_a.model_b_count IS NOT NULL

marți, 16 martie 2010, 10:28:28 UTC+2, phpMagpie a scris:
I would also run a SQl query direct on the database using phpMyAdmin
or the CLI

UPDATE model_a SET model_a.model_b_count = (SELECT COUNT(model_b.id)
FROM model_b WHERE model_b.model_a_id = model_a.id)

HTH

Paul

--
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 a topic in the Google Groups "CakePHP" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/cake-php/J6qKv8EBLMY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.

--
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 cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: