Re: What is *wrong* with this query??? - Mailing list pgsql-general

From Scott Marlowe
Subject Re: What is *wrong* with this query???
Date
Msg-id CAOR=d=1oV3nKxY7PuUJiUKeW+gX9Og_Xn_G4fL5W1gT3UrUgmg@mail.gmail.com
Whole thread Raw
In response to What is *wrong* with this query???  (Steve Murphy <smurphy@intorrent.com>)
List pgsql-general
On Fri, Nov 4, 2011 at 10:51 PM, Steve Murphy <smurphy@intorrent.com> wrote:
> select schedule.id as sched_id, bld.id as bid
>     from
>         schedule
>         left join company on schedule.company = company.id
>         left join (select * from building where building.company =
> company.id order by id limit 1)  as bld
>     where
>         schedule.status = 'active' and company.status = 'active' and
> bld.status = 'active';

Looks like you need an on clause after the second left join.

pgsql-general by date:

Previous
From: Cstdenis
Date:
Subject: Distinct on a non-sort column
Next
From: "David Johnston"
Date:
Subject: Re: What is *wrong* with this query???