Re: select records by nearest value - Mailing list pgsql-novice

From Lew
Subject Re: select records by nearest value
Date
Msg-id iqoffk$8di$1@news.albasani.net
Whole thread Raw
In response to Re: select records by nearest value  (e-letter <inpost@gmail.com>)
List pgsql-novice
On 05/15/2011 03:30 AM, e-letter wrote:
> Thanks, I read the link and received the following error:
>
> ERROR:  aggregates not allowed in WHERE clause
>
> Using the example:
>
> WHERE g1.gid = 1 and g1.gid<>  g2.gid
>
> The error occurs if the function:
>
> =1
>
> is replaced by:
>
> SUM(1000)

That's because SUM() is an aggregate function - it collects information over a
query or GROUP BY.  WHERE clauses operate on values from single records.  You
can get the effect with a correlated subquery, perhaps.

> Another question: what does '<>' mean? Couldn't find explanation in the manual.

Go to the manual
<http://www.postgresql.org/docs/9.0/interactive/>

Click on chapter 9, "Functions and Operators".
<http://www.postgresql.org/docs/9.0/interactive/functions.html>

Click on chapter 9.2, "Comparison Operators".
<http://www.postgresql.org/docs/9.0/interactive/functions-comparison.html>

--
Lew
Honi soit qui mal y pense.
http://upload.wikimedia.org/wikipedia/commons/c/cf/Friz.jpg

pgsql-novice by date:

Previous
From: e-letter
Date:
Subject: Re: select records by nearest value
Next
From: sanal mk
Date:
Subject: error in server connection