X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 996825398E; Sun, 27 Mar 2005 06:24:47 +0100 (BST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 11958-02; Sun, 27 Mar 2005 05:24:39 +0000 (GMT) Received: from vscan02.westnet.com.au (vscan02.westnet.com.au [203.10.1.132]) by svr1.postgresql.org (Postfix) with ESMTP id A328253742; Sun, 27 Mar 2005 06:24:37 +0100 (BST) Received: from localhost (localhost.localdomain [127.0.0.1]) by localhost (Postfix) with ESMTP id 0B89411D309; Sun, 27 Mar 2005 13:23:45 +0800 (WST) Received: from vscan02.westnet.com.au ([127.0.0.1]) by localhost (vscan02.westnet.com.au [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 29937-07; Sun, 27 Mar 2005 13:23:44 +0800 (WST) Received: from [202.72.133.22] (dsl-202-72-133-22.wa.westnet.com.au [202.72.133.22]) by vscan02.westnet.com.au (Postfix) with ESMTP id 75A3F11CB86; Sun, 27 Mar 2005 13:23:44 +0800 (WST) Message-ID: <42464392.9040903@familyhealth.com.au> Date: Sun, 27 Mar 2005 13:24:34 +0800 From: Christopher Kings-Lynne User-Agent: Mozilla Thunderbird 0.9 (Windows/20041103) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Virgile Beddok Cc: pgsql-novice@postgresql.org, pgsql-advocacy@postgresql.org, pgsql-admin@postgresql.org Subject: Re: [pgsql-advocacy] Function which gives back the nearest neighbours References: <2657.146.140.8.144.1111775776.squirrel@webmail.igd.fraunhofer.de> In-Reply-To: <2657.146.140.8.144.1111775776.squirrel@webmail.igd.fraunhofer.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.319 tagged_above=0 required=5 tests=AWL, SUBJ_HAS_SPACES X-Spam-Level: X-Archive-Number: 200503/440 X-Sequence-Number: 16938 > 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