Re: What is *wrong* with this query???

From: Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>
To: Steve Murphy <smurphy(at)intorrent(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: What is *wrong* with this query???
Date: 2011-11-05 18:55:02
Message-ID: CAOR=d=1oV3nKxY7PuUJiUKeW+gX9Og_Xn_G4fL5W1gT3UrUgmg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Nov 4, 2011 at 10:51 PM, Steve Murphy <smurphy(at)intorrent(dot)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.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message David Johnston 2011-11-05 18:57:03 Re: What is *wrong* with this query???
Previous Message Cstdenis 2011-11-05 18:39:40 Distinct on a non-sort column