Received: from sss.sss.pgh.pa.us (sss.pgh.pa.us [209.114.166.2]) by hub.org (8.9.3/8.9.3) with ESMTP id OAA04128 for ; Thu, 9 Dec 1999 14:22:09 -0500 (EST) (envelope-from tgl@sss.pgh.pa.us) Received: from sss.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.sss.pgh.pa.us (8.9.1/8.9.1) with ESMTP id OAA09195; Thu, 9 Dec 1999 14:20:20 -0500 (EST) To: wieck@debis.com (Jan Wieck) cc: wdemoudt@planetinternet.be (De Moudt Walter), Max.Buvry@enseeiht.fr, pgsql-sql@postgreSQL.org Subject: Re: [SQL] subquery, except and view In-reply-to: Your message of Thu, 9 Dec 1999 16:27:39 +0100 (MET) Date: Thu, 09 Dec 1999 14:20:20 -0500 Message-ID: <9193.944767220@sss.pgh.pa.us> From: Tom Lane wieck@debis.com (Jan Wieck) writes: >> test :>select client.num_clt, client.name from client, commamount where >> test :>(client.num_clt = commamount.num_clt) and >> test :>(3 > howmuch); >> >> This seems to do the job perfectly. Notice the value preceeding the >> column name in the comparison. Seems nescesary ... > Is definitely necessary, because 'howmuch' is an aggregate > column and the rewriter can only put that into the > qualification if the aggreate is on the right side of the > comparision. BTW, this restriction is no longer true in current sources, since single-result sub-SELECTs can now appear anywhere in an expression... regards, tom lane