I need the next available group of numbers where the reference column is null. In this case, the top 3 rows (where reference is null) would be 9000-9001, 9004. I need it to be 9004-9006. Basically, to fulfill the request with the first complete available range for a given quantity.