Ignited Datatables search stop whorking when using SUM or AVG functions inside query
Ignited Datatables search stop whorking when using SUM or AVG functions inside query
Ignited Datatables search stop whorking when using SUM or AVG functions inside query
My Query
$this->load->library('datatables');
$this->datatables
->select('products.id as product_id,products.name as product_name,products.quantity as product_quantity, categories.name as category_name,AVG(purchase_items.unit_price) as avg_cost ,((products.quantity*AVG(purchase_items.unit_price))) as total_amount')
->from('products')
->join('categories', 'products.category_id=categories.id', 'left')
->join('purchase_items', 'products.id=purchase_items.product_id', 'left')
->where('products.quantity > 0', NULL)
->group_by('products.id');