I'm trying to count the number of records in 'game_dates' where the
columns home_team_id or away_team_id have the same value. E.g., i
want to know the number of records for each team_id where team_id is
home_team_id or away_team_id.
I'm doing this in two separate select statements now. Example:
SELECT count(home_team_id),home_team_id FROM games
WHERE league_id = 218 and ((home_score IS NOT NULL OR away_score IS
NOT NULL) OR (home_score <> 0 OR away_score <> 0))
GROUP BY home_team_id
and
SELECT count(away_team_id),away_team_id FROM games
WHERE league_id = 218 and ((home_score IS NOT NULL OR away_score IS
NOT NULL) OR (home_score <> 0 OR away_score <> 0))
GROUP BY away_team_id
and then combining the results. Is there anyway to combine these to
queries into one query? ...and have a single result set returned with
two columns (count,team_id)?
Thanks,
Glenn