Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'imx365.i.id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by SELECT i.*,i.is_top as top,FROM_UNIXTIME(i.post_dateline) AS post_datetime,FROM_UNIXTIME(i.last_dateline) AS last_datetime,f.thread_link FROM bbs_inforums AS i LEFT JOIN forum_forums AS f ON i.forum_id = f.id WHERE i.is_top = 2 AND i.forum_id IN (44,45,46) GROUP BY i.thread_id ORDER BY i.last_dateline DESC