The title probably doesn't accurately describe my question, sorry about that.
I have two tables:
2016Athletes:
Name Position 40_dash Year Overall
Jared Goff QB 4.82 2016 1
Carson Wentz QB 4.77 2016 2
Joey Bosa DE 4.88 2016 3
Ezekiel Elliott RB 4.47 2016 4
Jalen Ramsey CB 4.41 2016 5
............
and
2017Athletes:
Name Position 40_dash Year Overall
Myles Garrett DE 4.64 2017 1
Mitchell Trubisky QB 4.67 2017 2
Solomon Thomas DE 4.69 2017 3
Leonard Fournette RB 4.51 2017 4
Corey Davis WR NULL 2017 5
..............
I first want to merge the 40_dash columns and find the average, which I could do a couple ways, but the real problem I'm having is that after I find the average, I then want to group by position. I'm not sure it it's relevant, but the goal is to eventually select one particular athlete I know to be an impressive outlier and compare him to the average for all athletes, all defensive players, and then all linebackers and this grouping is my initial baseline for the following queries in my report.
My best crack at it would be
select avg(40_dash)
from ((select 40_dash from 2016Athletes) union ALL
(select 40_dash from 2017Athletes)
)sl GROUP BY Position;
However, I know that won't work because the group by function is not correct. I'm not sure how to called the 'unioned' column once I have them merged.
Afterwards, I want to find each athlete with the fasted 40_dash time, also grouped by position. A min() function would seem to do the job, but again the group by is what's tripping me up.
Thanks to anyone who can assist!