Re: Query having issues...
| От | Alvaro Herrera |
|---|---|
| Тема | Re: Query having issues... |
| Дата | |
| Msg-id | Pine.LNX.4.44.0209131052030.2059-100000@cm-lcon1-46-187.cm.vtr.net обсуждение исходный текст |
| Ответ на | Query having issues... (Chris Bowlby <excalibur@hub.org>) |
| Список | pgsql-general |
Chris Bowlby dijo:
> SELECT co.first_name, co.last_name, co.email_address,
> a.password, c.company_number
> FROM contact co, domain d
> LEFT JOIN account_info a ON (co.contact_id = a.contact_id)
> LEFT JOIN company c ON (co.company_id = c.company_id)
> WHERE d.domain_id = '666'
> AND d.company_id = co.company_id;
Note that you are JOINing "domain d" with "account_info a"; by the time
this is looked up, there is no relation co there, so the qualification
doesn't make sense. Try this:
SELECT co.first_name, co.last_name, co.email_address,
a.password, c.company_number
FROM domain d, contact co
LEFT JOIN account_info a ON (co.contact_id = a.contact_id)
LEFT JOIN company c ON (co.company_id = c.company_id)
WHERE d.domain_id = '666'
AND d.company_id = co.company_id;
--
Alvaro Herrera (<alvherre[a]atentus.com>)
"Now I have my system running, not a byte was off the shelf;
It rarely breaks and when it does I fix the code myself.
It's stable, clean and elegant, and lightning fast as well,
And it doesn't cost a nickel, so Bill Gates can go to hell."
В списке pgsql-general по дате отправления: