Fix for
Who Visited This Topic 1.0.7
SQL-Error:
Code: Alles auswählen
Expression #3 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'USER_DB.w.counter_user' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by [1055]
Cause: Strict Use of SQL-Server Directive >
ONLY_FULL_GROUP_BY SQL
Info:
https://www.percona.com/blog/2019/05/13 ... -sql-mode/
Ext-Source: https://www.phpbb.com/customise/db/exte ... pic/216651
Related Topics:
https://www.phpbb.com/customise/db/exte ... pic/196886
https://www.phpbb.com/customise/db/exte ... pic/179781
Solution
Open in Ext >
event/listener.php
Find
Code: Alles auswählen
$query = 'SELECT w.user_id, w.topic_id, w.counter_user, w.date, u.username, u.user_colour, u.user_id, u.user_avatar, u.user_avatar_type, u.user_avatar_height, u.user_avatar_width, u.user_type, SUM(w.counter_user)
AS total
FROM ' . $this->whovisitedthistopic_table . ' w, ' . USERS_TABLE . ' u
WHERE w.topic_id = ' . (int) $topic_id . '
AND w.user_id = u.user_id
GROUP BY w.user_id
ORDER BY w.date DESC';
$row_query = $this->db->sql_query_limit($query, $value);
Replace with
Code: Alles auswählen
// Old Query
/*
$query = 'SELECT w.user_id, w.topic_id, w.counter_user, w.date, u.username, u.user_colour, u.user_id, u.user_avatar, u.user_avatar_type, u.user_avatar_height, u.user_avatar_width, u.user_type, SUM(w.counter_user)
AS total
FROM ' . $this->whovisitedthistopic_table . ' w, ' . USERS_TABLE . ' u
WHERE w.topic_id = ' . (int) $topic_id . '
AND w.user_id = u.user_id
GROUP BY w.user_id
ORDER BY w.date DESC';
$row_query = $this->db->sql_query_limit($query, $value);
*/
// Old Query
// New Query
$query = 'SELECT w.user_id, w.topic_id, w.counter_user, w.date, u.username, u.user_colour, u.user_id, u.user_avatar, u.user_avatar_type, u.user_avatar_height, u.user_avatar_width, u.user_type, SUM(w.counter_user)
AS total
FROM ' . $this->whovisitedthistopic_table . ' w, ' . USERS_TABLE . ' u
WHERE w.topic_id = ' . (int) $topic_id . '
AND w.user_id = u.user_id
GROUP BY w.user_id, w.topic_id, w.counter_user, w.date, u.username, u.user_colour, u.user_id, u.user_avatar, u.user_avatar_type, u.user_avatar_height, u.user_avatar_width, u.user_type
ORDER BY w.date DESC';
$row_query = $this->db->sql_query_limit($query, $value);
// New Query
Find
Code: Alles auswählen
$sql = 'SELECT topic_id, SUM(counter_user)
AS counter
FROM ' . $this->whovisitedthistopic_table . '
WHERE topic_id = ' . (int) $topic_id;
$result = $this->db->sql_query($sql);
$counter = (int) $this->db->sql_fetchfield('counter');
$this->db->sql_freeresult($result);
Replace with
Code: Alles auswählen
// Old Query
/*
$sql = 'SELECT topic_id, SUM(counter_user)
AS counter
FROM ' . $this->whovisitedthistopic_table . '
WHERE topic_id = ' . (int) $topic_id;
$result = $this->db->sql_query($sql);
$counter = (int) $this->db->sql_fetchfield('counter');
$this->db->sql_freeresult($result);
*/
// Old Query
// New Query
$sql = 'SELECT topic_id, SUM(counter_user)
AS counter
FROM ' . $this->whovisitedthistopic_table . '
WHERE topic_id = ' . (int) $topic_id . '
GROUP BY topic_id';
$result = $this->db->sql_query($sql);
$counter = (int) $this->db->sql_fetchfield('counter');
$this->db->sql_freeresult($result);
// New Query
Note: Bcs. of this Fix no changes on SQL-Server Settings
sql_mode=only_full_group_by
is needed