Welcome Guest, Not a member yet? Register   Sign In
how to create queries like this...
#12

[eluser]davidbehler[/eluser]
To solve your query problem:
Code:
$this->db->select('city.*, district.district_name');
$this->db->from('city');
$this->db->join('district', 'city.district_id = district.id');
$this->db->order_by('district.district_name', 'asc');
$this->db->order_by('city.city_name', 'asc');  

OR

$sql = "select city.*, district.district_name from city join district on city.district_id = district.id order by district.districr_name asc, city.city_name asc";

Does this work?


Messages In This Thread
how to create queries like this... - by El Forum - 07-29-2010, 02:53 AM
how to create queries like this... - by El Forum - 07-29-2010, 02:57 AM
how to create queries like this... - by El Forum - 07-29-2010, 03:01 AM
how to create queries like this... - by El Forum - 07-29-2010, 03:28 AM
how to create queries like this... - by El Forum - 07-29-2010, 03:29 AM
how to create queries like this... - by El Forum - 07-29-2010, 03:36 AM
how to create queries like this... - by El Forum - 07-29-2010, 03:44 AM
how to create queries like this... - by El Forum - 07-29-2010, 03:47 AM
how to create queries like this... - by El Forum - 07-29-2010, 03:53 AM
how to create queries like this... - by El Forum - 07-29-2010, 04:05 AM
how to create queries like this... - by El Forum - 07-29-2010, 04:08 AM
how to create queries like this... - by El Forum - 07-29-2010, 04:11 AM
how to create queries like this... - by El Forum - 07-29-2010, 04:22 AM
how to create queries like this... - by El Forum - 07-29-2010, 04:24 AM
how to create queries like this... - by El Forum - 07-29-2010, 04:26 AM
how to create queries like this... - by El Forum - 07-29-2010, 04:30 AM
how to create queries like this... - by El Forum - 07-29-2010, 04:33 AM
how to create queries like this... - by El Forum - 07-29-2010, 04:48 AM



Theme © iAndrew 2016 - Forum software by © MyBB