MY SQL Query:
SELECT * ,COUNT(posts_id) as `view `FROM `post_view` JOIN posts ON post_view.posts_id = posts.id
GROUP BY
posts_id
My Eloquent Laravel:
$this->model->Join('posts','post_view.posts_id', '=', 'posts.id')
->selectRaw('*, count(posts_id) as view')
->groupBy('posts_id')
->get();
Error when Get by Postman:
SQLSTATE[42000]: Syntax error or access violation: 1055 'databasePost.post_view.id' isn't in GROUP BY
(SQL: select *, count(posts_id) as view from `post_view` inner join `posts` on `post_view`.`posts_id` =
`posts`.`id` group by `posts_id`)