SELECT g.*, ctgs.name as ctg_name, a.name as album_name, auth.name as author_name, DATE_FORMAT(g.date, '%d.%m.%Y .') as date FROM gallery as g LEFT OUTER JOIN gallery_photo2ctg as p2ctg ON p2ctg.photo_id = g.id LEFT OUTER JOIN gallery_categories as ctgs ON ctgs.id = p2ctg.ctg_id LEFT OUTER JOIN gallery_albums as a ON a.id = g.album LEFT OUTER JOIN gallery_authors as auth ON auth.id = g.author WHERE g.published=1 AND ctgs.published=1 AND a.published=1 AND a.id='5' GROUP BY g.id ORDER BY g.date, g.id LIMIT 0, 30
Expression #17 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'popnano.ctgs.name' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by