X-Original-To: pgsql-sql@postgresql.org Received: from t-9.net (unknown [64.246.36.43]) by postgresql.org (Postfix) with SMTP id E9560474E42 for ; Fri, 21 Mar 2003 17:53:04 -0500 (EST) Received: (qmail 26133 invoked by uid 0); 21 Mar 2003 20:55:04 -0000 Received: from localhost (HELO seahat.com) (127.0.0.1) by localhost with SMTP; 21 Mar 2003 20:55:04 -0000 Received: from 65.102.128.233 (SquirrelMail authenticated user snubber@seahat.com) by fordparts.com with HTTP; Fri, 21 Mar 2003 14:55:04 -0600 (CST) Message-ID: <10814.65.102.128.233.1048280104.squirrel@fordparts.com> Date: Fri, 21 Mar 2003 14:55:04 -0600 (CST) Subject: column label From: "Ryan" To: X-Priority: 3 Importance: Normal X-Mailer: SquirrelMail (version 1.2.8) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Archive-Number: 200303/514 X-Sequence-Number: 12553 Ok I have a query in a program that looks something like this select reference_number as foo, '(10,10)'::point <-> point(x,y) as distance from imagemap where index_number = '2322' and block_number = '140' order by distance limit 1; I wanted to add a clause in where 'and distance < 30' but according to the postgres manual it says I cannot do that for WHERE or HAVING clauses, instead use the real name. However dropping the 'as distance' from my query gives me a column name of '?column?' which happens to not be worth a dang thing. How can it be done? (I suddenly have a feeling its going to require a subselect) Ryan