Re: ERROR: missing FROM-clause entry for table

From: "Charles Clavadetscher" <clavadetscher(at)swisspug(dot)org>
To: "'bigkev'" <kevin(dot)waterson(at)gmail(dot)com>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: ERROR: missing FROM-clause entry for table
Date: 2016-02-10 07:45:09
Message-ID: 036001d163d6$fdc96340$f95c29c0$@swisspug.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello

> -----Original Message-----
> From: pgsql-general-owner(at)postgresql(dot)org [mailto:pgsql-general-owner(at)postgresql(dot)org] On Behalf Of bigkev
> Sent: Mittwoch, 10. Februar 2016 08:11
> To: pgsql-general(at)postgresql(dot)org
> Subject: [GENERAL] ERROR: missing FROM-clause entry for table
>
> I am receiving this error for the query pasted below.
> Is the LEFT JOIN on the table not enough?
> What needs to happen here?
> I am guess something to do with derived tables
>
> http://pastie.org/10715876

It would help to know for which table the clause entry is missing. I guess that the order of the joins is not correct:

left join generate_series(c.start_time, c.end_time, '2 weeks'::interval) f(fortnight) ON g.day=f.fortnight
LEFT JOIN call_schedule c on extract(dow from c.start_time) = extract(dow from g.day) AND f.fortnight IS NOT NULL AND g.day BETWEEN
c.start_time AND c.end_time

In the first line you use c, but this is declared on the following line.

Bye
Charles

>
>
>
> --
> View this message in context: http://postgresql.nabble.com/ERROR-missing-FROM-clause-entry-for-table-tp5886750.html
> Sent from the PostgreSQL - general mailing list archive at Nabble.com.
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Roxanne Reid-Bennett 2016-02-10 08:02:33 Re: ERROR: missing FROM-clause entry for table
Previous Message Michael Paquier 2016-02-10 07:44:26 Re: ERROR: missing FROM-clause entry for table