Codeigniter - How to Join City Country State by concatenate two fields in Sql ::
$this->db->select(" CONCAT(c.name,'-',co.code) as id,CONCAT(c.name,' ,',s.name,' ,',co.name) as text",FALSE);
$this->db->from("city c");
$this->db->join('state s', 's.id=c.state_id', 'left');
$this->db->join('countries co', 'co.id=s.country_id', 'left');
$this->db->where('c.status','Y');
$this->db->order_by('c.id', 'ASC');
$query = $this->db->get();
$this->db->select(" CONCAT(c.name,'-',co.code) as id,CONCAT(c.name,' ,',s.name,' ,',co.name) as text",FALSE);
$this->db->from("city c");
$this->db->join('state s', 's.id=c.state_id', 'left');
$this->db->join('countries co', 'co.id=s.country_id', 'left');
$this->db->where('c.status','Y');
$this->db->order_by('c.id', 'ASC');
$query = $this->db->get();
No comments:
Post a Comment