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

From Christopher Kings-Lynne
Subject Re: [pgsql-advocacy] Function which gives back the nearest neighbours
Date
Msg-id 42464392.9040903@familyhealth.com.au
Whole thread Raw
In response to Function which gives back the nearest neighbours of a requested value  ("Virgile Beddok" <virgile.beddok@igd.fraunhofer.de>)
Responses Re: [pgsql-advocacy] Function which gives back the nearest neighbours
List pgsql-admin
> 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...

Chris

pgsql-admin by date:

Previous
From: "Dr. Roger Wießner"
Date:
Subject: PostgreSQL: ´GRANT ALL TO PUBLIC´ ?
Next
From: Michael Fuhr
Date:
Subject: Re: Question about trace session