[eluser]Ahmed Iqbal[/eluser]
we re using CodeIgniter, we want to get 6 categories latest 10 entries by (date), then we will display different categories results in view.
Code:
$this->db->select('*');
$this->db->from('ci_categories');
$this->db->join('ci_albums', 'ci_categories.cat_id = ci_albums.cat_id');
$this->db->group_by('ci_albums.cat_id');
$this->db->order_by('ci_albums.date', 'desc');
$this->db->limit(10);
here is our query, this query return 6 latest entries result. 1 result come from 1 category. we need 10 result form each category. mean total 60 results.