* Michael Widenius > The type of round(x,y) is double(max_double_digits,y) if y is a > constant and double(max_double_digits,4) if y isn't a constant. (The > 4 is just a chosen value, as we didn't think of any better value)
mysql> create table testme (number decimal (8,6),digits tinyint(3)); Query OK, 0 rows affected (0.05 sec) mysql> insert into testme values (100.4235,3),(85.4321,1); Query OK, 2 rows affected (0.00 sec) Records: 2 Duplicates: 0 Warnings: 0 mysql> select round(number,digits) from testme; +----------------------+ | round(number,digits) | +----------------------+ | 100.423000 | | 85.400000 | +----------------------+ 2 rows in set (0.00 sec) mysql> select round(number+0.00000000,digits) from testme; +---------------------------------+ | round(number+0.00000000,digits) | +---------------------------------+ | 100.42300000 | | 85.40000000 | +---------------------------------+ 2 rows in set (0.00 sec) It seems to me that the number of decimal digits in the result depends on the number of decimal digits in the X argument...? Also, the FORMAT(X,D) function seems to not work at all with a column as the second parameter: mysql> select format(number,digits) from testme; ERROR 1064: You have an error in your SQL syntax near 'digits) from testme' at line 1 (tested on win2k 3.23.30-gamma and solaris 3.23.39-log) -- Roger query --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php