In my script, I need to receive information from database (with httpd log file), by everyday traffic consumption.
So, if was 30 day in month I do it with following code, 30 times in cycle:
$sql = "SELECT round(sum(bytes)/1048576) FROM logdata WHERE time_stamp BETWEEN '2012-" .$aMonth . "-" . $aDay ." 00:00:00' AND '2012-" .$aMonth . "-" . $aDay ." 23:59:59' AND status=200";
It works rather slow.
I think, it possible to receive all results for all days in one resultset, with stored proc, or query.
Can anybody help me?
Thanks.
1 Answer