Hello > -----Original Message----- > From: pgsql-general-owner@xxxxxxxxxxxxxx [mailto:pgsql-general-owner@xxxxxxxxxxxxxx] On Behalf Of bigkev > Sent: Mittwoch, 10. Februar 2016 08:11 > To: pgsql-general@xxxxxxxxxxxxxx > Subject: 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@xxxxxxxxxxxxxx) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-general -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general