Distribution of records
| From: | Alan Milnes | Date: | Sat, 18 Feb 2006 21:35:56 +0000 |
| Subject: | Distribution of records | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-230700@lists.php.net to get a copy of this message | ||
Hi Guys,
I'm looking for some help in buiding up the right queries / code for this. I have a database that tracks all the plays of my Football Team. Here are the relevant Fields:-
Formation
OCall
DCall
OYards
Key
The key is an amalgam of the first 3 fields so a typical record might look like this:-
Formation - I
OCall - RT
DCall - BZ
OYards - 5
Key - IRTBZ
What I want to do is to produce report that looks like this:-
Form
OCall
DCall
OYards - Median
OYards - Mean
OYards < 0
OYards 0 - 4
OYards 5+
So in other words for every combination of Formation, OCall and DCall I want to report how many times it occured, what the Median and Mean values were and what the distribution of plays was.
I reckon I'm going to have to create an array and then loop over the array pulling out the relevant information but are there any special techniques I should consider?
Thanks
Alan