This concept applies to any Header Detail table relationship, for this example we'll talk about the SOP header/detail/serial lot relationship. We want back one line for each item in the order; and we want the serial/lots concatenated into one field. The final result will look like this:
The entire query that we need is below. Run the second script first, it's the function that makes the whole thing work.
This code is based on the TWO database