@karapho712 you can check the documentation and try to convert it piece by piece. See here: https://laravel.com/docs/8.x/queries
Mar 5, 2021
3
Level 1
How to count and do alias in query builder ?
How i can do this in query builder laravel ways ?
"select COUNT(DISTINCT idm) as total, COUNT(idm) FILTER (WHERE nilai=1) as jawab_1, COUNT(idm) FILTER (WHERE nilai=2) as jawab_2, COUNT(idm) FILTER (WHERE nilai=3) as jawab_3, COUNT(idm) FILTER (WHERE nilai=4) as jawab_4, COUNT(idm) FILTER (WHERE nilai=5) as jawab_5 from t_mahasiswa_quisinoer WHERE tahun_id='aaa' and kode_mk='bbb' and kelas='ccc' and kode_prodi='ddd';"
Please or to participate in this conversation.