From cadc125bb18686ec788a84c4051d1fbaa0dee4db Mon Sep 17 00:00:00 2001 From: Ninjasoturi <52629375+Ninjasoturi@users.noreply.github.com> Date: Mon, 9 Aug 2021 13:41:48 +0300 Subject: [PATCH] MySQL full_grou_by compatibility --- logic/history.php | 5 ++--- mods/history.php | 3 +-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/logic/history.php b/logic/history.php index 27440b80..2c243157 100644 --- a/logic/history.php +++ b/logic/history.php @@ -5,7 +5,7 @@ function create_history_date_msg_keys($current = '(SELECT max(start_time) FROM r // Reformat YYYY-MM to DATETIME $current = '\''.$current.'-01 00:00:00\''; } - $q = my_query(' SELECT DATE_FORMAT(start_time, "%d") as day, DATE_FORMAT(start_time, "%e") as day_disp, DATE_FORMAT('.$current.', "%Y-%m") as current_y_m, + $q = my_query(' SELECT DISTINCT DATE_FORMAT(start_time, "%d") as day, DATE_FORMAT(start_time, "%e") as day_disp, DATE_FORMAT('.$current.', "%Y-%m") as current_y_m, if((SELECT count(*) FROM raids left join attendance on attendance.raid_id = raids.id where end_time < UTC_TIMESTAMP() and date_format(start_time, "%Y-%m") = date_format(DATE_SUB('.$current.', INTERVAL 1 MONTH), "%Y-%m") and attendance.id is not null limit 1), date_format(DATE_SUB('.$current.', INTERVAL 1 MONTH), "%Y-%m"), 0) as prev, if((SELECT count(*) FROM raids left join attendance on attendance.raid_id = raids.id where end_time < UTC_TIMESTAMP() and date_format(start_time, "%Y-%m") = date_format(DATE_ADD('.$current.', INTERVAL 1 MONTH), "%Y-%m") and attendance.id is not null limit 1), date_format(DATE_ADD('.$current.', INTERVAL 1 MONTH), "%Y-%m"), 0) as next FROM raids @@ -14,8 +14,7 @@ function create_history_date_msg_keys($current = '(SELECT max(start_time) FROM r WHERE end_time < UTC_TIMESTAMP() AND date_format(start_time, "%Y-%m") = DATE_FORMAT('.$current.', "%Y-%m") AND attendance.id IS NOT NULL - GROUP BY DATE_FORMAT(start_time, "%d") - ORDER BY start_time ASC + ORDER BY DATE_FORMAT(start_time, "%d") ASC '); $day_keys = []; $current_y_m = ''; diff --git a/mods/history.php b/mods/history.php index 74040c16..a895c989 100644 --- a/mods/history.php +++ b/mods/history.php @@ -55,8 +55,7 @@ AND raids.end_time < UTC_TIMESTAMP() AND attendance.id IS NOT NULL AND gyms.gym_name IS NOT NULL - GROUP BY gym_name - ORDER BY gym_name + ORDER BY first_letter ' );