My table looks like
person_id | car_id | miles
------------------------------
1 | 1 | 100
1 | 2 | 200
2 | 3 | 1000
2 | 4 | 500
I need to total the miles for each person and then average those totals.
There are 2 people - person 1 drove 300 miles, person 2 drove 1500 miles.
(300+1500)/2 = 900 average number of miles driven per person.
Which is the same thing as totaling the number of miles and dividing by the number of people.
I cannot figure out a mySQL statement that will either give me the average across people or give me total the number of miles and the number of people so I can do the division.