- Local time
- Today, 04:39
- Joined
- Sep 12, 2006
- Messages
- 15,955
@MajP
Ok. I decided to have a look, and I can see the problem now.
So here's a thing. If I include the field [goal balance] in the non-working query, you get the same erroneous result, but if I add the field [games played] it magically shows 5 games for every team and works correctly.
I actually split the home games and away games into 2 separate queries, and unioned the queries, and still got your result. The individual queries were correct, but the union was incorrect. With a bit of trial and error, it actually shows the wrong result UNLESS [games played] is included. It actually reports 3 home and 1 away for team 1. Is there something special about the [games played] field that would cause this?
I then looked at the games and noted that team 1 had 2 home games that were both won 1-0. I then checked all the team results and team 2 had the same, but no other team had the same score in multiple games. I didn't check period 2, but I expect team 10 had 2 duplicate results on Period 2. (yes - I just checked and team 10 had 2 2-0 home wins)
Maybe the selection of columns from the union query treats these otherwise matching scores/results as duplicates unless you add something to the selection that forces it not to disregard duplicates, and the [games played] count may be the only field that can do that. Would that make sense?
Ok. I decided to have a look, and I can see the problem now.
So here's a thing. If I include the field [goal balance] in the non-working query, you get the same erroneous result, but if I add the field [games played] it magically shows 5 games for every team and works correctly.
I actually split the home games and away games into 2 separate queries, and unioned the queries, and still got your result. The individual queries were correct, but the union was incorrect. With a bit of trial and error, it actually shows the wrong result UNLESS [games played] is included. It actually reports 3 home and 1 away for team 1. Is there something special about the [games played] field that would cause this?
I then looked at the games and noted that team 1 had 2 home games that were both won 1-0. I then checked all the team results and team 2 had the same, but no other team had the same score in multiple games. I didn't check period 2, but I expect team 10 had 2 duplicate results on Period 2. (yes - I just checked and team 10 had 2 2-0 home wins)
Maybe the selection of columns from the union query treats these otherwise matching scores/results as duplicates unless you add something to the selection that forces it not to disregard duplicates, and the [games played] count may be the only field that can do that. Would that make sense?