0

I’m trying to pull

athleteid, firstname, lastname, rushyards, teamname


…while athletes.athleteid = ‘200’

My main goal besides getting this data out is that some athletes may move teams. So like atheleteid = ‘200’ may be on team 10 during weeks 1-4 but on team 15 for weeks 5-16. I’m trying to calculate the stats.rushyards for the entire team and since athleteid = ‘200’ got 20 yards from week 1-4 I want those stats to be reflected in team 10’s stats while his 80 yards during weeks 5-16 I want to be reflected for team 15’s data.


Table: athletes
Field: athleteid
Field: firstname
Field: lastname

Table: stats
Field: athleteid
Field: rushyards
Field: week

Table: tradelog
Field: athleteid
Field: teamid
Field: week

Table: teams
Field: teamid
Field: teamname


Any help is appreciated!

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by smantscheff
0

So show us your query, show us the results and what is the problem with it.
Besides there is a flaw in your table design.
If "rushyards" (whatever that means) is a function of athleteid and week, and teamid is a function of athleteid and week, too, these two (rushyards and teamid) should go into the same table stats. This also simplifies your query. With that design change there would be no more need for any athlete's data for calculating the team score - you could read it directly from stats grouped by teamid.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.