i have 2 tables, calendar and teams. in my calendar table i have 2 columns, home and away. In these column there is the id of the team. What i want to do is to show the name for each team instead of the ID.
Demaestro
6:21 pm on Sep 21, 2011 (gmt 0)
hey skoff
I think this is what you are wanting to do.
SELECT t.team_name FROM teams t left join calendar c on c.home = t.team_id
If you have questions post back
skoff
7:12 pm on Sep 21, 2011 (gmt 0)
i want for both team home and away this is where i have a problem.. :S
httpwebwitch
7:31 pm on Sep 21, 2011 (gmt 0)
SELECT calendar.home, (SELECT teams.name FROM teams WHERE teams.id = calendar.home) as homename, calendar.away, (SELECT teams.name FROM teams WHERE teams.id = calendar.away) as awayname FROM calendar
skoff
7:42 pm on Sep 21, 2011 (gmt 0)
great! Big thanks to you httpwebwitch that's exactly what i was looking for!