Код: Выделить всё
$this->db->select('stock_id,product_name,purchase_date,purchase_quantity,sale_quantity,stock_status');
$this->db->from('stock_details');
$this->db->join('product_details', 'stock_details.product_id_fk = product_details.product_id');
$this->db->join('purchase_details', 'product_details.product_id = purchase_details.product_id_fk');
$this->db->group_by('product_id');
$this->db->order_by('purchase_date','AESC');
$this->db->where('stock_status',1);
$query = $this->db->get();
Подробнее здесь: https://stackoverflow.com/questions/421 ... ld-be-adde
Мобильная версия