Hi All,

I have a problem working out a suitable algorithm either in PHP or MySQL. 

Basically I have a DB that keeps track of breeding records. Each record 
has a paired data, and a split-up date. 

I need to generate some statistics to work out average numbers of pairs 
per month, averaged on a daily basis, for a given start and stop date, 
typically a year or year-to-date.

All the algorithms I can think of are messy, where I have to loop through 
all the breeding records for every day of the year, and count how many 
pairs are breeding by seeing if the date is between the start and stop 
dates, and then average that on a monthly basis. I can't see 
that scaling very well, as there might be several hundred breeding records 
for a given year, multiplied by 365 days.

Has anyone any hints/pointers for an efficient way to do this?

Regards,
    Garry.


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to