Hello all I am hoping someone may help me:banghead:. I may be totally off mark with this but I believe that a sub query may help me sort this out. As part of a golf database upgrade I have added team numbers to players in a table called players. This table also collects the scores of each player.
The query posted below places all the teams from each club together and then shows the team with lowest score (Top 1 only being shown) I only want the top one to show BUT I need the query to ensure that all the members of the team (4 in all) have scores against their name. If not ignore that team. In the result shown of my query you will see that there are only 2 persons shown in this result as the other two members of the team did not have a score that day.
What the query does is groups the team together first, ignores the ones without any Nett score against their name and then displays the team with the lowest total score.
SELECT TOP 1 Players.[Team Number CBB], Sum(TeamTotalCBB([clubteam],[Team Number CBB])) AS TotalCBB, Players.Fullname, Players.clubteam, Players.[Nett Score Day 1], Players.NCRday1, Players.Scratched
FROM Players
GROUP BY Players.[Team Number CBB], Players.Fullname, Players.clubteam, Players.[Nett Score Day 1], Players.NCRday1, Players.Scratched
HAVING (((Players.[Team Number CBB])>0) AND ((Players.[Nett Score Day 1])>0) AND ((Players.NCRday1)=False) AND ((Players.Scratched)=False)) OR (((Players.[Team Number CBB])>0) AND ((Players.[Nett Score Day 1])>0) AND ((Players.NCRday1)=False) AND ((Players.Scratched)=False))
ORDER BY Sum(TeamTotalCBB([clubteam],[Team Number CBB]));
I hope this explains it
All the data required comes from one table called players and is based around the fields teamnumberCBB, Clubteam and TotalCBB.
I can paste a cut down version of the db if required
The query posted below places all the teams from each club together and then shows the team with lowest score (Top 1 only being shown) I only want the top one to show BUT I need the query to ensure that all the members of the team (4 in all) have scores against their name. If not ignore that team. In the result shown of my query you will see that there are only 2 persons shown in this result as the other two members of the team did not have a score that day.
What the query does is groups the team together first, ignores the ones without any Nett score against their name and then displays the team with the lowest total score.
SELECT TOP 1 Players.[Team Number CBB], Sum(TeamTotalCBB([clubteam],[Team Number CBB])) AS TotalCBB, Players.Fullname, Players.clubteam, Players.[Nett Score Day 1], Players.NCRday1, Players.Scratched
FROM Players
GROUP BY Players.[Team Number CBB], Players.Fullname, Players.clubteam, Players.[Nett Score Day 1], Players.NCRday1, Players.Scratched
HAVING (((Players.[Team Number CBB])>0) AND ((Players.[Nett Score Day 1])>0) AND ((Players.NCRday1)=False) AND ((Players.Scratched)=False)) OR (((Players.[Team Number CBB])>0) AND ((Players.[Nett Score Day 1])>0) AND ((Players.NCRday1)=False) AND ((Players.Scratched)=False))
ORDER BY Sum(TeamTotalCBB([clubteam],[Team Number CBB]));
I hope this explains it
All the data required comes from one table called players and is based around the fields teamnumberCBB, Clubteam and TotalCBB.
I can paste a cut down version of the db if required