Magne Mæhre wrote:
Colin Wetherbee wrote:
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 p
Colin Wetherbee wrote:
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
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
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 applicati
Try something like this where we alias the joined tables:
SELECT departure_date,
j1.code AS departure_code,
j2.code AS arrival_code
FROM jsjourneys
LEFT OUTER JOIN jsports AS j1 ON jsjourneys.departure_port = j1.id
LEFT OUTER JOIN jsports AS j2 ON jsjourneys.arrival_port = j2.id;
Paul Lambert wrote:
Colin Wetherbee wrote:
I would like to construct a query on the flight table that returns the
names of both the departure port and the arrival port.
The following query shows how I would get just the departure port.
js=# SELECT departure_date, jsports.code AS departure_cod
js=# SELECT departure_date, departure.code AS departure_code, arrival.code as
arraival_codeFROM jsjourneys JOIN jsports as departure ON
jsjourneys.departure_port = departure.id JOIN jsports as arrival on
jsjourneys.arraival_port = arraival.id LIMIT4;
Regards,Daniel Hernández.San
Colin Wetherbee wrote:
Greetings.
I have two tables I'm having a little trouble figuring out how to JOIN.
One contains a list of airports along with their IATA codes, cities,
names, and so forth. This table also contains an id column, which is a
serial primary key.
The other table contains
Greetings.
I have two tables I'm having a little trouble figuring out how to JOIN.
One contains a list of airports along with their IATA codes, cities,
names, and so forth. This table also contains an id column, which is a
serial primary key.
The other table contains a list of flights, each