Hopefully I can explain this well enough for someone to understand.
I am working with a database that has Baseball stats in it. Within the database there are 3 tables that i am concerned with.
1. Master - basically has all the personal information about all players. Birthday, college, etc.
2. Batting - has all the batting stats for each hitter for each year. homeruns, hits, walks, etc.
3. Fielding - Basic fielding stats. In this table if 1 player played two positions that year there are two records.
All the tables are linked with 1 field called playerID. I am running a query to pull records and do some basic statistical analysis. See a simplified version of the query below. What I want to do is have a field for position where I can see all the positions each player played more than 20 games last year. So in the that field if player X played just 1B all year it would say simply 1B. If he split time between 1st and 3rd it would say 1B 3B. I and then write it into the one field.
Just not sure how to add to my query to pull that data out and then write it to the field. Any help would be appreciated
$query="SELECT concat(nameFirst, ' ', nameLast) AS name,yearID, yearID-birthyear as AGE, G, AB, H, 2B, 3B, HR, RBI, R, BB, SB, MLB2010.Batting.playerID,FROM MLB2010.Batting, MLB2010.Master WHERE MLB2010.Batting.playerID=MLB2010.Master.playerID AND yearID=2010 ORDER BY totalpoints DESC LIMIT 300";