help with join

Поиск
Список
Период
Сортировка
От Jeff Brown
Тема help with join
Дата
Msg-id 35A78B8C.B9937F90@fastrans.net
обсуждение исходный текст
Список 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 по дате отправления:

Предыдущее
От: Jeff Brown
Дата:
Сообщение: help with join
Следующее
От: Michael J Schout
Дата:
Сообщение: Re: [SQL] The date of an entry?