Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

please solve my sql join codeigniter error

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 * FROM a.absensi JOIN s.siswa ON a.id_siswa = s.id_siswa JOIN kelas.k ON a.id_kelas = k.id_kelas WHERE a.id_kelas.
= ‘a.keterangan.*’

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading