0

I have 3 tables. delete_on_join

And I want to delete pegawai record using INNER JOIN, this works fine in MySQL.

DELETE p.* FROM pegawai p
INNER JOIN agama a ON p.agama_id = a.id
INNER JOIN jabatan j ON p.jabatan_id = j.id
WHERE a.id = 2 AND j.id = 5

But, how to use it on codeigniter? I can't find on query builder docs how to produce DELETE p.* FROM pegawai p

Ukasha
  • 2,238
  • 3
  • 21
  • 30
  • http://stackoverflow.com/questions/16435390/how-to-execute-my-sql-query-in-codeigniter –  May 05 '17 at 14:21
  • Thanks, sir. But is it possible to combine regular query and query builder, just like `$this->db->query($SQL)` with `$this->db->where('a.id',2)`? – Ukasha May 05 '17 at 14:26
  • regular query does not work with `$this->db->where('a.id',2)` as i remember (have not used CI for long time). But do try the proposed answer i think it is exactly what you need. –  May 05 '17 at 14:42

0 Answers0