How to Join sql query in php

$SELECT = "c.city_id,c.city_title,c.state_id,cn.cnt_id as country_id";

$FROM   = "td_city as c INNER JOIN td_states as s ON c.state_id=s.id INNER JOIN td_country as cn ON cn.cnt_id=s.country_id ";

$COND   = "c.city_id > 0  AND cn.cnt_id = 101 ORDER BY c.city_id";

## In Codeigniter Query is::

$this->db->select($SELECT);
$this->db->from($FROM);
$this->db->where($COND);

$CITY_QUERY = $this->db->get();
$CITY_RESULT = $CITY_QUERY->result_array();

Leave a Reply

Your email address will not be published. Required fields are marked *