开发者

Total time elapsed for each day CakePHP & MySQL

id  track_id    start                 stop                  created
4   7           2011-09-28 22:22:21   2011-09-28 22:22:30   2011-09-28 22:22:21
3   7           2011-09-28 22:22:07   2011-09-28 22:22:12   2011-09-28 22:22:07

Given the mysql structure and data above and the model name of Lapse. What sort of find/conditions would i use to get the output in array format:

2011-09-28 => 1 minute (or the total calculation of Stops - Starts)

So i can output a date and total elapsed time for that day?开发者_运维问答

Thanks


I'm not sure, but try something along this line: 'fields'=>array('SUM(UNIX_TIMESTAMP(Model.stop) - UNIX_TIMESTAMP(Model.start))') and 'group'=>'DATE_FORMAT(Model.created,"%Y-%m-%d")'

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜