[eluser]seanloving[/eluser]
[quote author="pete01" date="1264188945"]Try this:[/quote]
Now that I understand a couple more basics (thanks @pete01) I have this nice little function:
Code:
function get_inventory($location)
{
// for a given $location, return the product list showing product inventory levels
return $this->CI->db
->select('count(*) as qty,part_number,description,products.product_id')
->from('inventory')
->join('locations', 'locations.location_id=inventory.location_id')
->where('location_name',$location)
->join('products', 'products.product_id=inventory.product_id')
->group_by('products.product_id')
->get()->result_array();
}