From: skodak Date: Thu, 25 May 2006 15:57:20 +0000 (+0000) Subject: Bug #5582 - sort by numerical field doesn't work properly with decimals; merged from... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=4df627dfbfbd18c4c0121d71c5c47de5d5ebb1f1;p=moodle.git Bug #5582 - sort by numerical field doesn't work properly with decimals; merged from MOODLE_16_STABLE --- diff --git a/mod/data/field/number/field.class.php b/mod/data/field/number/field.class.php index 072a415645..78600b4ff9 100755 --- a/mod/data/field/number/field.class.php +++ b/mod/data/field/number/field.class.php @@ -48,8 +48,8 @@ class data_field_number extends data_field_base { global $CFG; switch ($CFG->dbtype) { - case 'mysql': // DECIMAL would be more accurate but only MySQL 5 supports it. - return 'CAST('.$fieldname.' AS SIGNED)'; + case 'mysql': // string in an arithmetic operation is converted to a floating-point number + return '('.$fieldname.'+0.0)'; default: return 'CAST('.$fieldname.' AS REAL)';