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

Re: [pgsql-advocacy] Function which gives back the nearest neighbours

From: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>
To: Virgile Beddok <virgile(dot)beddok(at)igd(dot)fraunhofer(dot)de>
Cc: pgsql-novice(at)postgresql(dot)org, pgsql-advocacy(at)postgresql(dot)org,pgsql-admin(at)postgresql(dot)org
Subject: Re: [pgsql-advocacy] Function which gives back the nearest neighbours
Date: 2005-03-27 05:24:34
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-adminpgsql-advocacypgsql-novice
> I'm looking for an existing function which allows me to search the nearest
> neighbours of the requested value.

Well you could try something like:

SELECT * FROM table ORDER BY ABS(val - 2) LIMIT 1;

That doesn't get you all the way there, but it's an idea...


In response to


pgsql-novice by date

Next:From: Bruno Wolff IIIDate: 2005-03-27 15:54:31
Subject: Re: I'd Like To See Permissions Granted
Previous:From: Stephen ChoulartonDate: 2005-03-26 23:13:59
Subject: initial password

pgsql-admin by date

Next:From: Michael FuhrDate: 2005-03-27 06:52:43
Subject: Re: Question about trace session
Previous:From: Joe HalpinDate: 2005-03-26 21:50:08
Subject: Problem setting runpath

pgsql-advocacy by date

Next:From: Robert BernierDate: 2005-03-27 14:52:52
Subject: Re: "Latest News" or "Latest Product"?
Previous:From: Virgile BeddokDate: 2005-03-25 18:36:16
Subject: Function which gives back the nearest neighbours of a requested value

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