Welcome to WebmasterWorld Guest from 54.158.175.78

Forum Moderators: open

Message Too Old, No Replies

Converting a number to a positive number in MySQL

   
11:13 pm on May 19, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



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?
3:21 pm on May 20, 2011 (gmt 0)

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



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]
3:33 pm on May 20, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



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

Thanks!