SELECT COUNT(DISTINCT p.id) as value FROM products p LEFT JOIN inventory i ON p.id = i.product_id WHERE (i.quantity <= p.reorder_level OR i.quantity IS NULL) AND p.reorder_level > 0 AND p.status = "active"