Re: Finding nearest numeric value - Mailing list pgsql-general

From Poul Møller Hansen
Subject Re: Finding nearest numeric value
Date
Msg-id 43034320.2040900@pbnet.dk
Whole thread Raw
In response to Re: Finding nearest numeric value  (Sean Davis <sdavis2@mail.nih.gov>)
Responses Re: Finding nearest numeric value  (Sean Davis <sdavis2@mail.nih.gov>)
List pgsql-general
>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
>
>
It does ideed, not that I understood how, but I will find out.
Thank you very much.

Poul


pgsql-general by date:

Previous
From: Christopher Browne
Date:
Subject: Re: cobol storedprocedures
Next
From: Csaba Nagy
Date:
Subject: Re: Finding nearest numeric value