help with join - Mailing list pgsql-sql

From Jeff Brown
Subject help with join
Date
Msg-id 35A78B8C.B9937F90@fastrans.net
Whole thread Raw
List pgsql-sql
I am looking for some sql help.  The SCHEDULES table has a row for every

football game of the year.  Each row has the week number, three letter
code for the home team, three letter code for the away team, and three
letter code for the winner.  The TEAMS table has a row for every team.
Each row has the three letter team code, the long name of the team and
other info that is not relevant to this problem.

Here are the two tables...

Table SCHEDULES

WEEK int not null,
HOME char(3) not null,
AWAY char(3) not null,
WINNER char(3)

Table TEAMS

CODE char(3) not null,
NAME char(25) not null

What I want to do is select all of the games for a particular week, and
get both the three letter codes and the long team names for both teams.

Example:

WEEK| HOME | HOME_NAME | AWAY | AWAY_NAME
1 | STL | St. Louis Rams | ARI | Arizona Cardinals
1 | MIN | Minnesota Vikings | WAS | Washington Redskins

I would really appreciate some help with the sql here.


Thanks!


Jeff

--

/**
 * @author Jeff S. Brown
 *
 * @return jbrown@fastrans.net
 *
 * @see http://jbrown.fastrans.net
 */




pgsql-sql by date:

Previous
From: Jeff Brown
Date:
Subject: help with join
Next
From: Michael J Schout
Date:
Subject: Re: [SQL] The date of an entry?