Re: SQL sums

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux