$ 0 0 Mike, Write an UDF with multiple input and multiple output. Please check examples in this blog.Group, Sort and handle Duplicate XML records – using UDF