From 95b906fa3f13b921d21715d8f1033ec351187eb9 Mon Sep 17 00:00:00 2001 From: SJ Date: Thu, 15 Dec 2016 11:07:36 +0100 Subject: [PATCH] fixed a mysql 5.7 introduced sql_mode issue Change-Id: I2af85d12d2bffaaecb340900b77b64cde3a2fab3 Signed-off-by: SJ --- webui/model/accounting/accounting.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/webui/model/accounting/accounting.php b/webui/model/accounting/accounting.php index 7ca23095..65618990 100644 --- a/webui/model/accounting/accounting.php +++ b/webui/model/accounting/accounting.php @@ -39,8 +39,8 @@ class ModelAccountingAccounting extends Model $return['stoptimestamp'] = $stop; // run query to return all messages - $tousers = $this->db->query('SELECT `sent`-(`sent`%86400) as `day`,`to`,count(*) as `count`,sum(`size`) as `size` FROM ' . VIEW_MESSAGES . ' WHERE `sent` >= '.$start.' AND `sent` < '.$stop.' GROUP BY FROM_UNIXTIME(`day`, "%Y.%m.%d."), `to`;'); - $fromusers = $this->db->query('SELECT `sent`-(`sent`%86400) as `day`,`from`,count(*) as `count`,sum(`size`) as `size` FROM ' . VIEW_MESSAGES . ' WHERE `sent` >= '.$start.' AND `sent` < '.$stop.' GROUP BY FROM_UNIXTIME(`day`, "%Y.%m.%d."), `from`;'); + $tousers = $this->db->query('SELECT ANY_VALUE(`sent`-(`sent`%86400)) as `day`,`to`,count(*) as `count`,sum(`size`) as `size` FROM ' . VIEW_MESSAGES . ' WHERE `sent` >= '.$start.' AND `sent` < '.$stop.' GROUP BY FROM_UNIXTIME(`day`, "%Y.%m.%d."), `to`;'); + $fromusers = $this->db->query('SELECT ANY_VALUE(`sent`-(`sent`%86400)) as `day`,ANY_VALUE(`from`),count(*) as `count`,sum(`size`) as `size` FROM ' . VIEW_MESSAGES . ' WHERE `sent` >= '.$start.' AND `sent` < '.$stop.' GROUP BY FROM_UNIXTIME(`day`, "%Y.%m.%d."), `from`;'); // process results from above four queries if($tousers->num_rows > 0)