0
我要顯示具有最高保留數的前9個位置。所以我必須有一個計數$this->db->group_by('t.id_pl')
,然後按該計數的數量進行排序。在CodeIgniter中計算的分組數
我已經成功地做到這一點,但我不明白的地方我應該把計數:
function select_pop()
{
$this->db->select('s.place as place, s.price as price, s.title as title');
$this->db->from('Places AS s');
$this->db->join('Reservations AS t', 't.id_pl= s.place', 'INNER');
$this->db->group_by('t.id_pl');
$this->db->order_by('');
$this->db->limit(9);
$result = $this->db->get();
return $result;
}
有什麼建議?