| From: | Marc André Paquin <web(at)inter-resa(dot)com> | 
|---|---|
| To: | pgsql-general(at)postgresql(dot)org | 
| Subject: | 2 tables, joins and same name... | 
| Date: | 2001-08-30 20:26:18 | 
| Message-ID: | 3B8EA16A.EE48BAB2@inter-resa.com | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-general | 
Hello,
Here is 2 tables:
airport
---------
airport_id
name
code
city_id
destination
-----------
destination_id
dest_name
...
airport_dep_id  // using airport.airport_id (departure)
airport_arr_id  // using airport.airport_id  has well (arrival)
I have 2 columns in the second table that uses the same name column in
the first table...
I dont know how to formulate my SQL query... I want to select the
destinations in the destination table with not the ID of each airport
but their names. I can do a join with one but with the second one, I get
no results... And this is confusing!
select dest.dest_name, air.name as airport1, air.name as airport2 from
destination, airport air where dest.airport_dep_id_id=air.airport_id and
dest.airport_arr_id=air.airport_id;
This is not good...
Any help?
Thanks!
--
Marc Andre Paquin
| From | Date | Subject | |
|---|---|---|---|
| Next Message | wsheldah | 2001-08-30 20:49:22 | Re: PostgreSQL what language | 
| Previous Message | Jakub Ouhrabka | 2001-08-30 18:55:10 | plpgsql function and constraints |