I have a problem to create Join query in codeigniter. Below is the code
public function getKeterangan($id_kelas){
$this->db->select('*')
->from('a.absensi')
->join('s.siswa', 'a.id_siswa = s.id_siswa')
->join('kelas.k', 'a.id_kelas = k.id_kelas')
->where('a.id_kelas.*', 'a.keterangan.*');
return $this->db->get()->result();
}
And the error shown like this :
You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘* = ‘a.keterangan.” at line 5
SELECT * FROMa.absensiJOINs.siswaONa.id_siswa=s.id_siswaJOINkelas.kONa.id_kelas=k.id_kelasWHEREa.id_kelas. = ‘a.keterangan.*’
Please help me to solve this.. I’m new in codeigniter
>Solution :
It looks like you have an issue with your ->where() statement in the query. You are trying to use a.id_kelas.* and a.keterangan.*, which are incorrect syntax. Instead, you should compare specific columns