Feb 5, 2004 #1 dude333 Programmer Feb 5, 2004 11 GB Hi, I want to add all the time values from one column in a table for the last 7 days of entries. Can anyone tell me the most effective way of doing this, is there a quick an easy wy to do this with mysql or is it better to write a php function. Thanks.
Hi, I want to add all the time values from one column in a table for the last 7 days of entries. Can anyone tell me the most effective way of doing this, is there a quick an easy wy to do this with mysql or is it better to write a php function. Thanks.
Feb 5, 2004 #2 vanekl Programmer Nov 25, 2003 69 US SELECT sec_to_time(sum(time_to_sec(yourfield))) FROM yourtable WHERE yourdatefield >= DATE_SUB(CURDATE(), INTERVAL 7 DAY)); Upvote 0 Downvote
SELECT sec_to_time(sum(time_to_sec(yourfield))) FROM yourtable WHERE yourdatefield >= DATE_SUB(CURDATE(), INTERVAL 7 DAY));