Software error:

Couldn't execute statement: Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'poetsquill.t.id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by in query 
			(
				SELECT DISTINCT t.id, t.title, t.description, t.moved_to, p.date last_post, p.author last_poster, t.started, t.starter, t.state, t.views, p.thread, COUNT(p.id) posts, MAX(p2.date) max_date
				FROM forum_threads t
				LEFT JOIN forum_posts p ON p.thread = t.id
				LEFT JOIN forum_posts p2 ON p2.thread = t.id
				WHERE t.forum = ? AND (t.state & ?)
				GROUP BY p.id HAVING last_post = max_date ORDER BY p.date DESC
			) UNION (
				SELECT DISTINCT t.id, t.title, t.description, t.moved_to, t.started last_post, t.starter last_poster, t.started, t.starter, t.state, t.views, 0, 1 as posts, 0 as max_date
				FROM forum_threads t
				WHERE t.moved_to IS NOT NULL AND (t.state & ?) AND (t.state & ?) AND t.forum = ?
			)
			ORDER BY last_post DESC
		 at /srv/sites/poetsquill/www/forums/forum.cgi line 183, <DATA> line 64.
	main::show_forum() called at /srv/sites/poetsquill/www/forums/forum.cgi line 29

For help, please send mail to the webmaster ([no address given]), giving this error message and the time and date of the error.