How to count a record when it is not there
I keep the stats for my high school hockey team that I coach, and I enter the score sheet data into my database and then print reports. Everything worked fine execpt that I noticed our Won/Loss record was incorrect. When I looked into it I found that it was because in the games where one team did not score that game did not get counted.
I have the header table:
PH_SCORE_HEADER
StatID
Home (team number/ID)
Visitor (team number/ID)
GameDate
and the detail table:
PH_SCORE_DETAIL
StatID
Team (team number/ID)
Scorer (player number/ID)
Basically I was counting all of the entries in the detail tabel, per game, for both the home team and the visiting team matching up the StatID, but if they did not score there was no entry in the detail for one or both teams, then my query was wrong.
Anyone have a way of making this work or do I have to resort to putting 2 more fields in the header table to keep track of the final score fo the game? I know there is enough information in the tables to make this work, but I can't seem to understand the logic or figure out the query to make it work to give me the scores for each game based on the detial entries so that I can produce the won/loss record correctly.
Thanks for your help.
__________________
Mitch
|