Re: SQL sums

From: Date: Fri, 03 Dec 2004 15:35:00 +0000
Subject: Re: SQL sums
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-203424@lists.php.net to get a copy of this message
This is an SQL question. James Nunnerley wrote:
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 (#203424) next »