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

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

Reply via email to