From: | "chris smith" <dmagick(at)gmail(dot)com> |
---|---|
To: | "Chris Velevitch" <chris(dot)velevitch(at)gmail(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Problem with complex outer join expression |
Date: | 2006-04-26 07:00:18 |
Message-ID: | 3c1395330604260000g46afa68ah4e976271ae61c2f9@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 4/26/06, Chris Velevitch <chris(dot)velevitch(at)gmail(dot)com> wrote:
> I'm using 7.4.5 on win XP Pro SP1.
>
> I'm getting:-
>
> ERROR: syntax error at or near "(" at character 155
>
> from the query:-
>
> 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;
>
> What this query is trying to achieve is:-
>
> Find all weekending dates between 2 given weekending dates and any
> corresponding timesheets for those weekending dates.
Table joins can only be done against another table & field, I don't
think you can do it using an expression like this. That should all be
in the where clause.
What do the timesheets and dummy_records tables look like?
--
Postgresql & php tutorials
http://www.designmagick.com/
From | Date | Subject | |
---|---|---|---|
Next Message | Teodor Sigaev | 2006-04-26 07:17:26 | Re: Please comment on the following OpenFTS/tsearch2 issues! |
Previous Message | IvoD | 2006-04-26 06:30:23 | Re: Database Selection |