RE: [PHP] SQL sums

From: Date: Fri, 03 Dec 2004 14:59:29 +0000
Subject: RE: [PHP] SQL sums
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-203420@lists.php.net to get a copy of this message
If someone doesn't give you an answer here, try php cookbook by O'reilly. It has this exact recipe in it. Best, Thomas S. Crum -----Original Message----- From: James Nunnerley [mailto:webmaster@jnsolutions.co.uk] Sent: Friday, December 03, 2004 9:56 AM To: php-general@lists.php.net Subject: [PHP] SQL sums I'm trying to create a table, and ultimately a graph, out of some syslog data. I have a mysql table with the following info in it: Time (unixtime stamp), bytes rcvd and bytes sent I want to create a sql statement that group the data over a certain period of time, and produces the following table: Time Sent Rcvd >From x to y Total bytes sent during period x to y Total bytes rcvd during period x to y >From y to z Total bytes sent during period y to z Total bytes rcvd during period y to z >From z to a Total bytes sent during period z to a Total bytes rcvd during period z to a >From a to b Total bytes sent during period a to b Total bytes rcvd during period a to b Now to create this I've tried a horrible method of using php to call sql table, and then go through each one, and add it to each period of time as appropriate. it's messy and slow! What I want to do is have the mysql do this.is it possible? Cheers Nunners

« previous php.general (#203420) next »