ये रहा:-
$query = $this->db->query('SELECT city, COUNT(city) AS jobcount FROM `jobs` GROUP BY city ORDER BY jobcount DESC');
if ($query->num_rows() > 0)
foreach ($query->result() as $row)
$data[] = array(
'total' => $row->jobcount,
'city' => $row->city
);
return $data;
'jobs'
swap को स्वैप करना न भूलें अपने टेबल नाम के साथ