@MKhalidJunaid: your solution worked for quite a while. However, we now get multiple results sets instead of the only two latest int_proc's. Can you please execute the following table at http://www.sqlfiddle.com/#!2/e81fdf/2
(this might be due to the unordered rows of data?)
CREATE TABLE test
(`id` int, `customer_id` varchar(1), `int_proc` int, `inventory` int)
;
INSERT INTO test
(`id`, `customer_id`, `int_proc`, `inventory`)
VALUES
(1, 'A', 1, 1),
(2, 'A', 4, 1),
(3, 'A', 5, 1),
(4, 'A', 0, 1),
(5, 'A', 5, 1),
(6, 'A', 6, 1),
(7, 'A', 6, 1),
(8, 'A', 7, 1),
(9, 'A', 9, 1),
(10, 'B', 91, 2),
(11, 'B', 92, 2),
(12, 'B', 93, 2),
(13, 'B', 95, 2),
(14, 'B', 95, 2),
(15, 'C', 22, 1)
;