Re: join problem - Mailing list pgsql-sql

From Ales Vojacek
Subject Re: join problem
Date
Msg-id 466FF578.5040507@fbl.cz
Whole thread Raw
In response to join problem  ("A. R. Van Hook" <hook@lake-lotawana.mo.us>)
List pgsql-sql
There is not referenced table cai in from clausule.

A. R. Van Hook napsal(a):
> I have join problem:
> "select i.ivid, v.eventdate, v.deposit, v.invdate, cai.db,
>                 sum(i.tax) as tax,
>                 sum(i.tax + i.rowtot) as totalP,
>                 (sum(i.tax + i.rowtot) - v.deposit) as balance
>               from invoice v
>               left outer join
>                      invoiceitems i
>                 on  v.ivid = i.ivid
>               where v.cusid = $cusid
>                     and   v.cusid = cai.cusid                group by
> i.ivid,  v.eventdate, v.deposit, v.invdate, cai.db
> ERROR:  missing FROM-clause entry for table "cai"
>
> If I add cai to the from clause "from invoice v, cai,  I get
> ERROR:  missing FROM-clause entry for table "cai"
> ERROR:  invalid reference to FROM-clause entry for table "v"
>
> Where do I add the cai table reference???
>
> thanks
>


pgsql-sql by date:

Previous
From: Michael Glaesemann
Date:
Subject: Re: join problem
Next
From: Bob Singleton
Date:
Subject: calculate time diffs across rows with single timestamp