From 482ada0934ac73f6dc5e4e6343f27a73d622af18 Mon Sep 17 00:00:00 2001 From: songchenxuan Date: Fri, 10 Nov 2023 14:00:56 +0800 Subject: [PATCH] * Merge commit 07963e065b, use lastest code. --- module/pivot/model.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/module/pivot/model.php b/module/pivot/model.php index 480b1483cc..65a08a03be 100644 --- a/module/pivot/model.php +++ b/module/pivot/model.php @@ -1607,7 +1607,15 @@ class pivotModel extends model } else { - $columnSQL = "$stat(tt.`$field`) as `$uuName`"; + if($fields[$field]['type'] != 'number' and in_array($stat, array('avg', 'sum'))) + { + $convertSql = $this->config->db->driver == 'mysql' ? "CAST(tt.`$field` AS DECIMAL(32, 2))" : "TO_DECIMAL(tt.`$field`)"; + $columnSQL = "$stat($convertSql) as `$uuName`"; + } + else + { + $columnSQL = "$stat(tt.`$field`) as `$uuName`"; + } } if($slice != 'noSlice') $columnSQL = "select $groupList,`$slice`,$columnSQL from ($sql) tt" . $connectSQL . $groupSQL . ",tt.`$slice`" . $orderSQL . ",tt.`$slice`";