LEFT JOIN problem

Поиск
Список
Период
Сортировка
От Michael Rowan
Тема LEFT JOIN problem
Дата
Msg-id CAL04MkmW9yWv-A7qZw9jwf956CO8C26v3NY4DYWNs2uASQc52g@mail.gmail.com
обсуждение исходный текст
Ответы Re: LEFT JOIN problem  (Jayadevan M <maymala.jayadevan@gmail.com>)
Re: LEFT JOIN problem  (Mael Rimbault <mael.rimbault@gmail.com>)
Список pgsql-novice
Hi
Extreme novice here. Pls be gentle. I have a database with four tables

orders (have a foreign key to depots.de_id)
depots (have a foreign key to customers.co_id)
companies
addresses

depots have an optional cross reference from depots.de_ad_id to addresses.ad_id

so:

SELECT co_id, de_id, or_id
FROM orders, depots, companies
LEFT JOIN addresses ON (de_ad_id=ad_id)
WHERE or_id=de_or_id AND co_id=de_co_id;

returns error 
ERROR:  invalid reference to FROM-clause entry for table "depots"
LINE 1: ...pots, orders, companies LEFT JOIN addresses ON (depots.de_...
                                                             ^
HINT:  There is an entry for table "depots", but it

The error message is incomplete.

Any idea whats wrong with my code?  Thanks

Mike


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

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: User with "almost" superuser privileges
Следующее
От: Jayadevan M
Дата:
Сообщение: Re: LEFT JOIN problem