Hi All

I have Model Project (id,name) hasMany Task (id, project_id,
estimated_hours). How to retrieve all projects with calculated column
estimated_hours= sum of estimated_hours of all tasks of that project ?

I have done this with following custom query but I want find method's
$params array :

SELECT SUM( `Task`.`estimated_hours` ) AS estimated_hour, `Project` .
* , `Task`.`project_id` , `Project`.`id`
FROM `projects` AS `Project`
LEFT JOIN tasks AS Task ON ( Task.project_id = Project.id )
GROUP BY `Project`.`id`


Thanks in advance!

Manish Pithwa

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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

Reply via email to