List:General Discussion« Previous MessageNext Message »
From:Dan Greene Date:January 13 2004 4:35pm
Subject:RE: MIN with negative numbers in VARCHAR
View as plain text  
ok... you might have two options:

1- (don't know if this will work)
do a min(cast(Value * 1000000 as signed integer) / 1000000

2- or min(Value + 0.0)

and see what happens.

> -----Original Message-----
> From: Eldon Ziegler [mailto:eldonz@stripped]
> Sent: Tuesday, January 13, 2004 11:24 AM
> To: mysql@stripped
> Subject: RE: MIN with negative numbers in VARCHAR
> 
> 
> DOUBLE doesn't seem to be an option with CAST
> 
> At 10:31 am 1/13/2004, you wrote:
> >Could you CAST them first, then apply MIN?
> >
> > > -----Original Message-----
> > > From: Eldon Ziegler [mailto:eldonz@stripped]
> > > Sent: Tuesday, January 13, 2004 9:56 AM
> > > To: mysql@stripped
> > > Subject: MIN with negative numbers in VARCHAR
> > >
> > >
> > > We have a table with floating point measurement values stored
> > > in VARCHAR's.
> > > How can I get MIN in SELECT to evaluate these as numbers
> > > instead of strings
> > > so negative value sort correctly? Right now I've kludged it as
> > > MIN(SIGN(Value) * ABS(Value)). Is there a more straight 
> forward way?
> > >
> > >
> > > --
> > > MySQL General Mailing List
> > > For list archives: http://lists.mysql.com/mysql
> > > To unsubscribe:
> > > http://lists.mysql.com/mysql?unsub=1
> > >
> > >
> >
> >--
> >MySQL General Mailing List
> >For list archives: http://lists.mysql.com/mysql
> >To unsubscribe:    
> http://lists.mysql.com/mysql?unsub=1
> 
> 
> -- 
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    
> http://lists.mysql.com/mysql?unsub=1
> 
> 
Thread
MIN with negative numbers in VARCHAREldon Ziegler13 Jan
RE: MIN with negative numbers in VARCHARDan Greene13 Jan
  • RE: MIN with negative numbers in VARCHAREldon Ziegler13 Jan
RE: MIN with negative numbers in VARCHARDan Greene13 Jan
  • RE: MIN with negative numbers in VARCHAREldon Ziegler13 Jan