HOW do you determine the first fifty games played? Is there a date field in
there somewhere?
IF there is a date field then you might have a query like
SELECT A.*
FROM GamesPlayed as A
WHERE A.[GameDate] in
(SELECT TOP 50 [GameDate]
FROM GamesPlayed as B
WHERE B.[Player Name] = A.[Player Name]
ORDER BY B.[GameDate] ASC)
That will give you the 50 earliest GamesPlayed for each player.
John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
pat67 wrote:
You need to supply more details to get a good answer. Check out the following
URL for an explanation on how to get the TOP N records per group using a subquery.
http://allenbrowne.com/subquery-01.html#TopN
If you post back with some details on your table structure perhaps someone can
give you more detailed instructions.
John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
pat67 wrote:
In my Db I have player stats that I am tracking. I want to run a query
where I use only the stats from the first 50 games of each players
total stats. Can someone assist?
Example:
John has 52 wins 28 losses for the year. But in his first 50 games he
had a record of 31 wins and 19 losses. I want to be able to run a
query to show that.- Hide quoted text -
- Show quoted text -
There are no game number fields. I have a table with the results and
several queries to get to the overall stats. I am not that experienced
so i do in a couple of queries what an expert could probably do in
one. But I will show my query for the records.
SELECT tblRosters.[Player Name], tblRosters.[Team Name], Sum(IIf(IsNull
([Wins]),0,[Wins]))+Sum(IIf(IsNull([Losses]),0,[Losses])) AS Games, Sum
(IIf(IsNull([Wins]),0,[Wins])) AS Win, Sum(IIf(IsNull([Losses]),0,
[Losses])) AS Loss, Sum(IIf(IsNull([RO's]),0,[RO's])) AS Runouts, IIf
([Games]=0,0,Sum(IIf(IsNull([Wins]),0,[Wins]))/[Games]) AS Pct
FROM ZqryLosses RIGHT JOIN (ZqryWins RIGHT JOIN tblRosters ON
ZqryWins.Winner = tblRosters.[Player Name]) ON ZqryLosses.Loser =
tblRosters.[Player Name]
GROUP BY tblRosters.[Player Name], tblRosters.[Team Name]
ORDER BY Sum(IIf(IsNull([Wins]),0,[Wins])) DESC;
Basically I take the results table and run a query for total wins and
another query for total losses. Then I combine those 2 queries with
the rosters table to ensure I get every player whether he played or
not. That's this query. What I need is to stop a player's count at 50
games played.- Hide quoted text -
- Show quoted text -