homepage Welcome to WebmasterWorld Guest from 54.145.209.77
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / Databases
Forum Library, Charter, Moderator: open

Databases Forum

    
Converting a number to a positive number in MySQL
dataguy

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 4314976 posted 11:13 pm on May 19, 2011 (gmt 0)

This seems like it would be simple, but I can't figure out how to do it.

I have a value which may or may not be positive, but I need it to be positive every time. Is there a function for this?

 

whoisgregg

WebmasterWorld Senior Member whoisgregg us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 4314976 posted 3:21 pm on May 20, 2011 (gmt 0)

You can get the absolute value using ABS():
http://dev.mysql.com/doc/refman/5.0/en/mathematical-functions.html#function_abs [dev.mysql.com]

dataguy

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 4314976 posted 3:33 pm on May 20, 2011 (gmt 0)

Oh, that's exactly what I was looking for. I should have known that.

Thanks!

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Databases
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved