From a59bf0ce35755fdecebd1f7391c0cb986ddf2a18 Mon Sep 17 00:00:00 2001 From: Peter Goodhall Date: Tue, 13 Jan 2026 10:45:52 +0000 Subject: [PATCH] Fix SQL query to use 'in' for station_id comparison Updated the SQL query to use 'station_id in (...)' instead of 'station_id = ...' in the subquery, ensuring correct filtering when multiple station IDs are provided. --- application/models/Iota.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/application/models/Iota.php b/application/models/Iota.php index a543c6503..895298d62 100644 --- a/application/models/Iota.php +++ b/application/models/Iota.php @@ -163,8 +163,8 @@ class IOTA extends CI_Model { join iota on thcv.col_iota = iota.tag where station_id in (" . $location_list . ") and thcv.col_iota is not null - and not exists (select 1 from ". $this->config->item('table_name') . " where station_id = ". $location_list . - " and col_iota = thcv.col_iota"; + and not exists (select 1 from ". $this->config->item('table_name') . " where station_id in (" . $location_list . ") + and col_iota = thcv.col_iota"; if ($postdata['mode'] != 'All') { $sql .= " and (col_mode = '" . $postdata['mode'] . "' or col_submode = '" . $postdata['mode'] . "')";