List:General Discussion« Previous MessageNext Message »
From:Steven Staples Date:July 20 2010 6:36pm
Subject:RE: [MySQL] Re: Decimal points
View as plain text  
Just out of curiosity, why not do it in the application layer?

Or maybe, you can try:
SELECT BINARY 1+1.2;
=  2.2
SELECT BINARY 1+1.0;
= 2
SELECT CAST(1+1.2 AS UNSIGNED);
= 2
SELECT CAST(1+1.6 AS UNSIGNED);
= 3 (so I guess rounding happens here)

And then I guess ultimately, you could also use FLOOR() CEIL() or ROUND()
SELECT ROUND(1+1.6, 0);
= 3
SELECT FLOOR(1+1.6);
= 2
SELECT CEIL(1+1.6);
= 3



Steven Staples


> -----Original Message-----
> From: Ashley M. Kirchner [mailto:ashley@stripped]
> Sent: July 20, 2010 1:52 PM
> To: mysql@stripped
> Subject: Re: [MySQL] Re: Decimal points
> 
> On 7/20/2010 10:07 AM, Chris W wrote:
> > I try to avoid asking why but in this case I have to.  I can't imagine
> > wanting to have a list of numbers displayed and not have them all
> > aligned right with the sane number of digits after the decimal
> > point.   So why would you even want to do this is?
> 
>      Wish I can give you an answer, but it's a requirement from the
> client.  Their application needs it displayed that way.  '101' and
> '101.0' appear to have completely different meanings.  Especially since
> more often than not, it's followed by a letter.  I don't know, I'm just
> the programmer here.
> 
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    http://lists.mysql.com/mysql?unsub=1
> 
> No virus found in this incoming message.
> Checked by AVG - www.avg.com
> Version: 9.0.839 / Virus Database: 271.1.1/3009 - Release Date: 07/20/10
> 02:36:00

Thread
Decimal pointsAshley M. Kirchner19 Jul
  • Re: Decimal pointsMark Goodge19 Jul
    • Re: Decimal pointsChris W20 Jul
      • Re: [MySQL] Re: Decimal pointsAshley M. Kirchner20 Jul
        • RE: [MySQL] Re: Decimal pointsSteven Staples20 Jul
  • RE: Decimal pointsSamrat Kar19 Jul
Re: Decimal pointsNguyen Manh Cuong19 Jul