I am not a DBA and I inherited this query and i'm not quite sure why I'm getting a sql_mode=only_full_group_by
error. Especially since the error is talking about result.fullURL
and i don't see that in the query. Could someone please explain this to me?
Query
SELECT *
FROM (
SELECT content.*, content.navigationOrder AS sortOrder
FROM LB_Content AS content
INNER JOIN LB_Content AS other ON content.contentSectionId = other.contentSectionId
WHERE other.fullURL = '/index'
AND content.contentSlug <> 'index'
GROUP BY content.contentId
UNION
SELECT content.*, query.sectionOrder AS sortOrder
FROM LB_Content AS content, (
SELECT section.*
FROM LB_ContentSections AS section
INNER JOIN LB_Content AS other ON section.parentContentSectionId = other.contentSectionId
WHERE other.fullURL = '/index'
) AS query
WHERE content.contentSectionId = query.contentSectionId
AND content.contentSlug = 'index'
) as result,
LB_ContentTypes AS types
WHERE result.showInNavigation = 1
AND result.status = 1
AND result.published = 1
AND result.contentTypeId = types.contentTypeId
AND types.useOption = 1
GROUP BY result.contentId
ORDER BY result.sortOrder ASC
Error output
SQLSTATE[42000]: Syntax error or access violation: 1055 Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'result.fullURL' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
Thanks for any help!