Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
How do I write the following query in cakephp format?
SELECT COUNT( ip_address ) AS num_values FROM property_viewers GROUP BY property_viewers.ip_address ORDER BY property_viewers.id DESC
$this->model->find("count",array("fields"=>"ip_address",'group'=>'property_viewers.ip_address','order'=>'property_viewers.id DESC'))
http://book.cakephp.org/1.3/view/1018/find#find-count-1020
Add a comment
$options['fields'] = array("ip_address"); $options['group'] = array("property_viewers.ip_address"); $options['order'] = array('property_viewers.id DESC'); $this->model->find("count",$options);
By using this you dont have to worry about nested arrays
Required, but never shown
By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.
Start asking to get answers
Find the answer to your question by asking.
Explore related questions
See similar questions with these tags.