join problem - Mailing list pgsql-sql

From A. R. Van Hook
Subject join problem
Date
Msg-id 466FEEC9.4050300@lake-lotawana.mo.us
Whole thread Raw
Responses Re: join problem  (Guillaume Lelarge <guillaume@lelarge.info>)
Re: join problem  (Ales Vojacek <alesv@fbl.cz>)
Re: join problem  (Michael Glaesemann <grzm@seespotcode.net>)
Re: join problem  (Ales Vojacek <alesv@fbl.cz>)
List pgsql-sql
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

-- 
Arthur R. Van Hook    Mayor - RetiredThe City of Lake Lotawana

hook@lake-lotawana.mo.us
hook@lota.us
avanhook3@comcast.net
(816) 578-4704 - Home
(816) 564-0769 - Cell




pgsql-sql by date:

Previous
From: "Pavel Stehule"
Date:
Subject: Re: setof or array as input parameter to postgresql 8.2 functions
Next
From: Guillaume Lelarge
Date:
Subject: Re: join problem