Skip site navigation (1) Skip section navigation (2)

Re: select records by nearest value

From: Lew <noone(at)lewscanon(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: select records by nearest value
Date: 2011-05-15 12:04:16
Message-ID: iqoffk$8di$ (view raw or whole thread)
Lists: 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

Click on chapter 9, "Functions and Operators".

Click on chapter 9.2, "Comparison Operators".

Honi soit qui mal y pense.

In response to

pgsql-novice by date

Next:From: sanal mkDate: 2011-05-19 10:29:10
Subject: error in server connection
Previous:From: e-letterDate: 2011-05-15 07:30:20
Subject: Re: select records by nearest value

Privacy Policy | About PostgreSQL
Copyright © 1996-2015 The PostgreSQL Global Development Group