Error Group By #34318
Unanswered
javawebmedia
asked this question in
General
Error Group By
#34318
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Description:
I got an error when using groupBy. I changed the database config from strict => true to strict => false, but the query still did not work really well.
This is my query:
public function nav_berita()
{
$query = DB::table('berita')
->join('kategori', 'kategori.id_kategori', '=', 'berita.id_kategori')
->select('berita.judul_berita', 'kategori.id_kategori','kategori.slug_kategori', 'kategori.nama_kategori')
->where(array( 'berita.status_berita' => 'Publish',
'berita.jenis_berita' => 'Berita'))
->groupBy('kategori.id_kategori')
->orderBy('berita.id_berita','DESC')
->get();
return $query;
}
And the error code is below:
Illuminate\Database\QueryException
SQLSTATE[42000]: Syntax error or access violation: 1055 'client_aws.berita.judul_berita' isn't in GROUP BY (SQL: select
berita
.judul_berita
,kategori
.id_kategori
,kategori
.slug_kategori
,kategori
.nama_kategori
fromberita
inner joinkategori
onkategori
.id_kategori
=berita
.id_kategori
where (berita
.status_berita
= Publish andberita
.jenis_berita
= Berita) group bykategori
.id_kategori
order byberita
.id_berita
desc) (View: D:\XAMPP\htdocs\awsindonesia\resources\views\layout\menu.blade.Steps To Reproduce:
Beta Was this translation helpful? Give feedback.
All reactions