Hi I have a table like
matches
match_id, home_team_id, away_team_id, home_team_player_1_id, home_team_player_2_id, ....
and I have tables
teams
team_id, team_name
players
player_id, player_name
Now I am trying to get the query the matches table with the actual names instead of ids.
query_result
match_id, home_team_name, away_team_name, home_team_player_1_name, ...
Is there a neat way to 'replace' ids with the lookup values from the tables? The only way to do this that I can come up with is to join the teams table for each team and then the player name table for each player. Is there a better way to do this than writing 50 joins?
I dont want to alter the actual match table, just get the names in the query.