"Chris Velevitch" <chris.velevitch@xxxxxxxxx> writes: > select dummy_records.sequence_nr,timesheets.weekending,timesheets.timesheet_id > from dummy_records > ,left outer join timesheets > on (timesheets.weekending = ('2006-04-09' + (integer > dummy_records.sequence_nr-1)*7))) > where dummy_records.sequence_nr between 1 and (date '2006-04-23' - > date '2006-04-09')/7+1; > ERROR: syntax error at or near "(" at character 155 > What am I doing wrong here? The comma before LEFT OUTER JOIN is incorrect, and the keyword "integer" is being used inappropriately. I think you've miscounted your parentheses too. regards, tom lane