Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 210469FB58A for ; Wed, 13 Jun 2007 11:15:41 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 85862-09 for ; Wed, 13 Jun 2007 11:15:24 -0300 (ADT) X-Greylist: delayed 00:27:17.349079 by SQLgrey-1.7.4 Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 42F789FB526 for ; Wed, 13 Jun 2007 11:15:33 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 Received: from mail.fbl.cz (mail.fbl.cz [212.80.68.3]) by svr4.postgresql.org (Postfix) with ESMTP id 1DAB35AF67D for ; Wed, 13 Jun 2007 13:48:12 +0000 (GMT) Received: from localhost (mail.fbl.cz [127.0.0.1]) by mail.fbl.cz (Postfix) with ESMTP id A68B38C100 for ; Wed, 13 Jun 2007 15:47:45 +0200 (CEST) Received: from mail.fbl.cz ([127.0.0.1]) by localhost (mail.fbl.cz [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 07977-08 for ; Wed, 13 Jun 2007 15:47:44 +0200 (CEST) Received: from [172.16.18.22] (avojacek.fbl.local [172.16.18.22]) by mail.fbl.cz (Postfix) with ESMTP id 67D5E8C0C8 for ; Wed, 13 Jun 2007 15:47:44 +0200 (CEST) Message-ID: <466FF578.5040507@fbl.cz> Date: Wed, 13 Jun 2007 15:47:36 +0200 From: Ales Vojacek Reply-To: alesv@fbl.cz User-Agent: Thunderbird 2.0.0.0 (Windows/20070326) MIME-Version: 1.0 Cc: pgsql-sql@postgresql.org Subject: Re: join problem References: <466FEEC9.4050300@lake-lotawana.mo.us> In-Reply-To: <466FEEC9.4050300@lake-lotawana.mo.us> X-Enigmail-Version: 0.95.1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: amavisd-new at fbl.cz X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.001 tagged_above=0 required=5 tests=BAYES_50=0.001 X-Spam-Level: X-Archive-Number: 200706/92 X-Sequence-Number: 28582 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 >