On 8/17/05 8:50 AM, "Poul Møller Hansen" <[EMAIL PROTECTED]> wrote:

> Does anyone know how to find the row with the nearest numeric value, not
> necessarily an exact match ?

To find the nearest value in number_column to some CONSTANT (where you
replace constant with a number), try:

select *,(number_column - CONSTANT)^2 as d from tablename order by d limit
1;

Does that do it for you?

Sean


---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

               http://www.postgresql.org/docs/faq

Reply via email to