MySQL Forums
Forum List  »  Newbie

Re: nonaggregated column which is not functionally dependent GROUP BY clause
Posted by: Phillip Ward
Date: April 26, 2016 05:56AM

Quote

ALL of the fields in tblIR are "functionally dependent" on IDIR ...

Sorry, but no; they're not.

What it's trying to tell you is that the fields that you are selecting are not "functionally dependent" on the field(s) that you're grouping by.

It's forcing you to think about the aggregation that you're performing and attaching a suitable aggregate function to every selected column that you're not already grouping by, something like :

select 	tblIR.IDIR
,       MIN( EBirth.EventD )   AS EBirthD
,       MAX( EDeath.EventD )   AS EDeathD
,       MIN( tblNX.Surname )   AS indexsurname
,       MIN( tblNX.GivenName ) AS indexgivenname
,       MAX( tblNX.`Order` )   AS indextype
. . . 
group by tblIR.IDIR

It's exactly the sort of thing that you might expect from an option called "only_full_group_by".

https://dev.mysql.com/doc/refman/5.7/en/group-by-handling.html


Actually, looking at the query itself, I can't see why you'd need any grouping in this query at all. I would strongly recommend removing it and see what you get as a result.

Regards, Phill W.

Options: ReplyQuote


Subject
Written By
Posted
Re: nonaggregated column which is not functionally dependent GROUP BY clause
April 26, 2016 05:56AM


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.