Tady to je:-
$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;
Nezapomeňte prohodit 'jobs'
s názvem vaší tabulky