开发者

converting MySQL query to Codeigniter syntax

开发者 https://www.devze.com 2023-03-14 03:32 出处:网络
I have 开发者_开发技巧some problem converting a MYSQL query to CI syntax. This my MySQL syntax:

I have 开发者_开发技巧some problem converting a MYSQL query to CI syntax.

This my MySQL syntax:

select a.pbj_name as 'NAMA PERUSAHAAN', count(a.id_pbj) as 'JUMLAH PAKET', group_concat(c.paket_kode) as 'PILIHAN PAKET'
from jed_pbj a
left join jed_paket_pbj b
       on a.id_pbj=b.id_pbj
left join jed_paket c
       on b.id_paket=c.id_paket
group by a.id_pbj


Check out this Active Record class in Codeigniter,

$this->db->select("a.pbj_name as 'NAMA PERUSAHAAN', count(a.id_pbj) as 'JUMLAH PAKET', group_concat(c.paket_kode) as 'PILIHAN PAKET'");
$this->db->from('jed_pbj a');
$this->db->join('jed_paket_pbj b', 'a.id_pbj=b.id_pbj', 'left');
$this->db->join('jed_paket c', 'b.id_paket=c.id_paket', 'left');
$this->db->group_by("a.id_pbj"); 
$this->db->get();
0

精彩评论

暂无评论...
验证码 换一张
取 消