Re: Query Problem

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: Query Problem
Дата
Msg-id 4254F351.2020707@archonet.com
обсуждение исходный текст
Ответ на Query Problem  (Abdul Wahab Dahalan <wahab@mimos.my>)
Список pgsql-sql
Abdul Wahab Dahalan wrote:
> If I've 2 tables like this:
> 
> Country table : with 2 fields (country and id)
> 
> Country             id
> England            E
> France               F
> Japan                J
> 
> FlightTo table : with 2 fields(Flight ID and Destination)
> 
> FlightID            Destination
> B1                     E,J
> B2                     E,F
> B3                     J,F

Simplest solution is to correct this table - "Destination" should be two 
fields (e.g. dest_from,dest_to). Then you could do something like:

SELECT  flight_id,  c1.country as from_country,  c2.country as to_country
FROM flight_to, country c1, country c2
WHERE  dest_from = c1.id  AND dest_to = c2.id
;
--  Richard Huxton  Archonet Ltd


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

Предыдущее
От: Abdul Wahab Dahalan
Дата:
Сообщение: Query Problem
Следующее
От: bandeng
Дата:
Сообщение: Re: [despammed] Crosstab function