SELECT 0_item_codes.stock_id, 0_item_codes.description, item_moves.sum_qty, 0_loc_stock.reorder_level
FROM 0_loc_stock
INNER
JOIN 0_item_codes ON 0_item_codes.stock_id = 0_loc_stock.stock_id
AND 0_item_codes.inactive =0
INNER
JOIN (
SELECT stock_id, SUM( qty ) AS sum_qty
FROM 0_stock_moves
WHERE loc_code = 'CC'
GROUP
BY stock_id
) AS item_moves ON item_moves.stock_id = 0_item_codes.stock_id
WHERE 0_loc_stock.loc_code = 'CC'
AND item_moves.sum_qty <= 0_loc_stock.reorder_level