Postingan lainnya
mysql subquery
bagaimana mengatasi error Subquery returns more than 1 row di mysql ? berikut lampiran query nya :
$query = $this->db->query('SELECT tanggal,
( SELECT COUNT(*) from absensi_siswa where kehadiran="alfa" GROUP BY tanggal ) AS alfa,
( SELECT COUNT(*) from absensi_siswa where kehadiran="izin" GROUP BY tanggal ) AS izin,
( SELECT COUNT(*) from absensi_siswa where kehadiran="hadir" GROUP BY tanggal ) AS hadir,
( SELECT COUNT(*) from absensi_siswa where kehadiran="sakit" GROUP BY tanggal ) AS sakit
FROM absensi_siswa GROUP BY tanggal');
return $query->result();
0
2 Jawaban:
Hasil yang ingin dicapai dari query tersebut apa mbak? Mungkin ada solusi query lain.
0