The call_schedule table looks like this id | integer | not null default nextval('call_schedule_id_seq'::regclass) account_id | integer | not null user_id | integer | not null call_type_id | integer | not null call_frequency_id | integer | not null start_time | timestamp without time zone | not null duration | integer | not null end_time | timestamp without time zone | not null Indexes: "call_schedule_pkey" PRIMARY KEY, btree (id) Foreign-key constraints: "call_schedule_account_id_fkey" FOREIGN KEY (account_id) REFERENCES accounts(id) "call_schedule_call_frequency_id_fkey" FOREIGN KEY (call_frequency_id) REFERENCES call_frequency(id) "call_schedule_call_type_id_fkey" FOREIGN KEY (call_type_id) REFERENCES call_types(id) "call_schedule_user_id_fkey" FOREIGN KEY (user_id) REFERENCES users(id) This stores the start_time, which is the date and time a series of calls begins. The duration defines how long this event(call) will go for, and the end_time defines when the schedule will stop. I need to generate a calendar eg: 1 year with intervals of 1 day, and include fortnightly calls at the appropriate dates. the call_frequency_id would be 5 for a fortnightly call. I an post schema if you need. -- View this message in context: http://postgresql.nabble.com/ERROR-missing-FROM-clause-entry-for-table-tp5886750p5886990.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