swap relations to be able to execute a left join

Поиск
Список
Период
Сортировка
От David Rio Deiros
Тема swap relations to be able to execute a left join
Дата
Msg-id 20051209171615.GA30790@milhouse.digitaria.com
обсуждение исходный текст
Ответы Re: swap relations to be able to execute a left join
Re: swap relations to be able to execute a left join
Список pgsql-general
Hi there,

The other day, a coworker who loves mysql was complaining to me because
he had a hard time to find out why this query didn't work on PostgreSQL:

    SELECT
        AR.artifact_id,
        AT.type_nm,
        AR.title,
        U.dept,
    FROM
        Artifact_Revisions AR,
        Revisions_to_Types RTT,
        Artifact_Types AT
    LEFT JOIN
        Users U
        on (U.user_id = AR.principal_user_id)
    WHERE
        AR.revision_id = RTT.revision_id
        AND RTT.type_id = AT.type_id
        AND AR.revision_id = 28403;

Apparently, once he swapped the 1st (AR) and the 3rd (AT) relation in
the FROM, the query worked.

He took the opportunity to tell how much he doesn't like PostgreSQL and
how much he loves mysql. Apparently, he told me (I didn't confirm it)
in mysql you wouldn't need to swap the order of the relations
to execute the query.

I am sure there is a good reason why you have to swap the relations
in PostgreSQL. Anyone?

Thanks,

David


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

Предыдущее
От: William
Дата:
Сообщение: Solaris 10 Sun Studio 11 compile error configtest
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Solaris 10 Sun Studio 11 compile error configtest