D
Dj
My table looks like this
name - mpg - mpg date - training date
Every emp has a record for each month tracking their mpg. The training date
remains empty until they get training which could be just once or once every
6 months. When they get trained, the training date goes in the most recent
record. A sampling of this table would be ...
joe 6.4 jul08 null
joe 6.2 aug08 9/3/08
joe 6.8 sep08 null
bob 7.4 jul08 null
bob 6.9 aug08 null
bob 6.8 sep08 null
ann 6.4 jul08 null
ann 6.5 aug08 9/15/08
ann 7.0 sep08 null
Here's what I'd like to do... if the driver had training, I'd like to
calculate the change in MPG from prior to their training to following their
training. I just can't seem to figure out how to do it. It doesn't matter
if the final output is a query or report. I'm beginning to think that I
should pull the training date out of the main table and put it in a seperate
table. Would that make this task easier.
Using the sample data above, my report/query would return the following only
the employees who had training and the difference in their mpg from the month
prior to training until after...
Joe trained on 9/3/08 6.8-6.2=.6
Ann trained on 9/15/08 7.0-6.5=.5
or simplified...
Joe .6
Ann .5
Thanks in advance for your help. Dj
name - mpg - mpg date - training date
Every emp has a record for each month tracking their mpg. The training date
remains empty until they get training which could be just once or once every
6 months. When they get trained, the training date goes in the most recent
record. A sampling of this table would be ...
joe 6.4 jul08 null
joe 6.2 aug08 9/3/08
joe 6.8 sep08 null
bob 7.4 jul08 null
bob 6.9 aug08 null
bob 6.8 sep08 null
ann 6.4 jul08 null
ann 6.5 aug08 9/15/08
ann 7.0 sep08 null
Here's what I'd like to do... if the driver had training, I'd like to
calculate the change in MPG from prior to their training to following their
training. I just can't seem to figure out how to do it. It doesn't matter
if the final output is a query or report. I'm beginning to think that I
should pull the training date out of the main table and put it in a seperate
table. Would that make this task easier.
Using the sample data above, my report/query would return the following only
the employees who had training and the difference in their mpg from the month
prior to training until after...
Joe trained on 9/3/08 6.8-6.2=.6
Ann trained on 9/15/08 7.0-6.5=.5
or simplified...
Joe .6
Ann .5
Thanks in advance for your help. Dj