i tried the CakePHP 3.x "Bookmaker Tutorial" and i followed the instruction step by step. Unfortunately, at the end of the first chapter i get the attached error:
Error: SQLSTATE[42000]: Syntax error or access violation: 1055 Expression #8 of SELECT list
is not in GROUP BY clause and contains nonaggregated column 'wis.Tags.id' which is not
functionally dependent on columns in GROUP BY clause; this is incompatible with
sql_mode=only_full_group_by
Furthermore, i get the information to check my "BookmarksTags" table but i do not have to creat one before. I little bit confused.
Please try correcting the issue for the following table aliases:
BookmarksTags
I already google my problem and i found information to update the "my.cnf" with a extra line. i already try but nothing happed. I also check the spelling and downloaded the "bookmarker-tutorial" from github but i still get this error above.
I use MySQL 5.7.11 and PHP 5.6.14.
This is a new thing in MySQL 5.7 and is a warning that your query is ambiguous.
Consider the following table:
id | name | age | points
--------------------------------------------
1 Bob 21 1
2 James 14 1
3 Bob 21 3
4 James 14 2
5 Casey 17 3
If you did the following query:
SELECT name, age, SUM(points) FROM scores GROUP BY name
Then the name
column is used for grouping. Note that age
may have multiple values, so it's "non-aggregated". You need to do something to collapse down those values.
The behaviour in 5.6 and previous was to just pick the first one depending on sort order, though this was sometimes unpredictable and would fail. In 5.7 they're preventing you from doing it in the first place.
The solution here is to group on that as well, or to apply an aggregate operator like MIN()
to it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With