homepage Welcome to WebmasterWorld Guest from 54.227.41.242
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Visit PubCon.com
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




msg:4314978
 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




msg:4315336
 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




msg:4315345
 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