pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ryan <pgsql-sql@seahat.com>
To: pgsql-sql@postgresql.org
Subject: column label
Date: Fri, 21 Mar 2003 14:55:04 -0600 (CST)
Message-ID: <10814.65.102.128.233.1048280104.squirrel@fordparts.com> (raw)

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





view thread (4+ messages)  latest in thread

Message-ID: <10814.65.102.128.233.1048280104.squirrel@fordparts.com>
Permalink:  ../10814.65.102.128.233.1048280104.squirrel@fordparts.com/
Also on:    postgresql.org/message-id/10814.65.102.128.233.1048280104.squirrel@fordparts.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: pgsql-sql@seahat.com
  Subject: Re: column label
  In-Reply-To: <10814.65.102.128.233.1048280104.squirrel@fordparts.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox