Re: JOIN a table twice for different values in the same query

Поиск
Список
Период
Сортировка
От Colin Wetherbee
Тема Re: JOIN a table twice for different values in the same query
Дата
Msg-id 47869EF7.70106@denterprises.org
обсуждение исходный текст
Ответ на Re: JOIN a table twice for different values in the same query  (Colin Wetherbee <cww@denterprises.org>)
Ответы Re: JOIN a table twice for different values in the same query  (Magne Mæhre <Magne.Mahre@Sun.COM>)
Список pgsql-sql
Colin Wetherbee wrote:
> Phillip Smith wrote:
>> As a side note - all the IATA codes are unique for each airport -
>> wouldn't it be better to use these as the Primary Key and Foreign
>> Keys? Then you wouldn't have to even join the tables unless you
>> wanted the port names (not just the code)
> 
> This is true, but FWIW, my application will mostly be joining for the 
> name of the airport or the city, not the code.
> 
> I'll keep the idea of using the codes as keys in mind, though.  Thanks 
> for pointing that out.

Oh, now I remember why I'm using IDs as keys. ;)

The code isn't always going to be an airport, and, for example, a train 
station in Buenos Aires could conceivably have the same code as a 
shipping port in Rotterdam, which, in turn, might well be JFK. :)

Colin


В списке pgsql-sql по дате отправления:

Предыдущее
От: Colin Wetherbee
Дата:
Сообщение: Re: JOIN a table twice for different values in the same query
Следующее
От: "Daniel Caune"
Дата:
Сообщение: SQL stored function inserting and returning data in a row.