MySQL Forums
Forum List  »  General

sql_mode=only_full_group_by
Posted by: Bernie van't Hof
Date: November 27, 2019 02:14AM

SELECT DISTINCT
`A/C#` AS `A/C#`,
`MyRef` AS `MyRef`,
DATEDIFF('2017-06-30', `Date`) AS `Days`,
`Dr` - `Cr` AS `Balance`
FROM
`BERNIE`.`answer`
GROUP BY
`A/C#`,
`MyRef`
ORDER BY
BINARY `A/C#`,
BINARY `MyRef`,
`Days`,
`Balance`

ERROR: Expression #3 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'bernie.answer.Date' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

Can make the error go away by including Date, Dr, and Cr in the GROUP BY.

Adding the aliases of the calculated fields (Days & Balance) to the GROUP BY also runs gets rid of the error. Now I'm more confused.

Options: ReplyQuote


Subject
Written By
Posted
sql_mode=only_full_group_by
November 27, 2019 02:14AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.