On 2/9/2016 11:11 PM, bigkev wrote:
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
Your error is in the reference to c.start_time, c.end_time. During the
parse, the system doesn't know about "c" yet.
and swapping fortnight and "c" won't help - you can't reference
c.start_time in the "from" portion of the join.
So - substituting static values for c.start_time, c.end_time :
select * FROM generate_series('2016-01-22', '2017-12-31', '1
day'::interval) g(day)
left join generate_series('2015-01-25', '2016-07-01', '2
weeks'::interval) f(fortnight) ON g.day=f.fortnight
generates results... but I'm not sure it is giving you what you want.
Exactly what are you trying to achieve with the fortnight construct?
BTW - assuming call_schedule.start_time is a timestamp... do your
start/end times cross day boundaries? the test g.day between start/end
will never be true otherwise - you are dealing with "midnight" values
for time.
e.g. '2016-01-23' does not fall between '2016-01-23 08:30:01' and
"2016-01-23 10:45:01'
Roxanne
--
[At other schools] I think the most common fault in general is to teach students how to pass exams instead of teaching them the science.
Donald Knuth
--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general