This topic is locked

making a day to day report

11/27/2006 11:42:01 PM
PHPRunner General questions
D
darkmage0 author

Hello
I have a months worth of data,timedate stamped and broken down into three columes,(datetime/ph/turb) in my mysql data base.there is a record every five minutes. I need to divide it down into days then pull the highest, lowest and average of (ph/turb) each day. then listed day to day for a month. and then give the highest, lowest, and average record of the full month.
I was wondering if I had to make 31 different quies. or is there an easier way to do this
thank you very much Travis

J
Jane 11/28/2006

Travis,
try to play around group by clause.

Here is a sample:

select `field1`,

`field2`,

max(`field2`) as `max_field2`,

min(f`ield2`) as `min_field2`,

avg(`field2`) as `average_field2`

from `TableName`

group by `datetime`