Welcome Guest, Not a member yet? Register   Sign In
use foreach or single query? (Counting Inventory)
#15

[eluser]seanloving[/eluser]
Hooray that works. THANKS. Sincerely, Sean Loving
Code:
function get_inventory($location_id)
    {
        // for a given $location_id, return the product list showing product inventory levels
        return $this->CI->db
                        ->select('count(inventory.inventory_id) AS qty, part_number, description, products.product_id, locations.inventory_id')
                        ->from('products')
                        ->join('inventory', 'inventory.product_id = products.product_id AND location_id='.$location_id, 'left')
                        ->join('locations', 'locations.location_id=inventory.location_id', 'left')
                        ->group_by('product_id')
                        ->get()->result_array();
    }


Messages In This Thread
use foreach or single query? (Counting Inventory) - by El Forum - 01-22-2010, 07:21 AM
use foreach or single query? (Counting Inventory) - by El Forum - 01-22-2010, 07:35 AM
use foreach or single query? (Counting Inventory) - by El Forum - 01-22-2010, 07:49 AM
use foreach or single query? (Counting Inventory) - by El Forum - 01-22-2010, 09:05 AM
use foreach or single query? (Counting Inventory) - by El Forum - 01-22-2010, 09:29 AM
use foreach or single query? (Counting Inventory) - by El Forum - 01-22-2010, 10:24 AM
use foreach or single query? (Counting Inventory) - by El Forum - 01-22-2010, 11:07 AM
use foreach or single query? (Counting Inventory) - by El Forum - 01-22-2010, 12:20 PM
use foreach or single query? (Counting Inventory) - by El Forum - 01-22-2010, 01:54 PM
use foreach or single query? (Counting Inventory) - by El Forum - 01-22-2010, 02:02 PM
use foreach or single query? (Counting Inventory) - by El Forum - 01-22-2010, 03:43 PM
use foreach or single query? (Counting Inventory) - by El Forum - 01-22-2010, 04:05 PM
use foreach or single query? (Counting Inventory) - by El Forum - 01-22-2010, 04:43 PM
use foreach or single query? (Counting Inventory) - by El Forum - 01-22-2010, 04:46 PM
use foreach or single query? (Counting Inventory) - by El Forum - 01-22-2010, 08:21 PM



Theme © iAndrew 2016 - Forum software by © MyBB