From 3f7d68acedf42a8a526c3017acf80c559f127321 Mon Sep 17 00:00:00 2001 From: Peter Goodhall Date: Sat, 25 Apr 2020 21:51:44 +0100 Subject: [PATCH] Fixed SQL error --- application/models/Dayswithqso_model.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/application/models/Dayswithqso_model.php b/application/models/Dayswithqso_model.php index 7c75547b9..2d0c2bc59 100644 --- a/application/models/Dayswithqso_model.php +++ b/application/models/Dayswithqso_model.php @@ -15,12 +15,16 @@ class Dayswithqso_model extends CI_Model $CI->load->model('Stations'); $station_id = $CI->Stations->find_active(); - $sql = "select year(COL_TIME_ON) Year, count(distinct COL_TIME_ON) Days from " + + + $sql = "select year(COL_TIME_ON) Year, COUNT(DISTINCT TO_DAYS(COL_TIME_ON)) as Days from " .$this->config->item('table_name'). " thcv where station_id = " . $station_id . " and COL_TIME_ON is not null group by year"; $query = $this->db->query($sql); + print_r($query->result()); + return $query->result(); }