Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column '' 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 = WHERE i.is_top = 2 AND i.forum_id IN (21,22,23) GROUP BY i.thread_id ORDER BY i.last_dateline DESC