Syntax error or access violation: 1055 Expression #8 of SELECT list is not in GROUP BY clause and contains nonaggregated column

前端 未结 5 820
时光说笑
时光说笑 2021-02-13 15:28

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:



        
5条回答
  •  说谎
    说谎 (楼主)
    2021-02-13 16:13

    In addition to tadman's comment, for tutorial you are following, you should distinct your sql select query by both Bookmarks.id and BookmarksTags.tag_id, instead of just Bookmarks.id

    To do that, in BookmarksTable.php file, line

    ->distinct(['Bookmarks.id'])
    

    should look like

    ->distinct(['Bookmarks.id', 'BookmarksTags.tag_id'])
    

提交回复
热议问题