Search Postgresql Archives

swap relations to be able to execute a left join

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux