List:General Discussion« Previous MessageNext Message »
From:Peter Brawley Date:July 31 2006 7:51pm
Subject:Re: Finding the closest value
View as plain text  
/>Is there an efficient way to find the closest numerical value, across
 >three columns? I do not know if there is a way to find it across one. /

Not sure about efficiency, but if the criterion number is @n, do you 
mean ...

SELECT LEAST( ABS(MIN(@n-col1)),
              LEAST( ABS(MIN(@n-col2)),
                     ABS(MIN(@n-col3))
                   )
            )
FROM ...

?

PB

-----

Lee Goddard wrote:
> Is there an efficient way to find the closest numerical value, across 
> three columns? I do not know if there is a way to find it across one.
>
> I thought about plotting the values in a geometric space, but that 
> would seem to require more dimensions that the server can handle. I 
> thought about using a Kohonen network, but I would prefer to use MySQL.
>
> Many thanks in anticipation
> Lee
>

Attachment: [text/html]
No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.394 / Virus Database: 268.10.5/403 - Release Date: 7/28/2006
Thread
Finding the closest valueLee Goddard31 Jul
  • Re: Finding the closest valuePeter Brawley31 Jul
    • Re: Finding the closest valueLee Goddard3 Aug
      • Re: Finding the closest valuePeter Brawley4 Aug