Now I think about it, just dumping the data into a table (which I
dislike because they can contain stale data if not managed) and right
joining back would have been easier and a lot less code intensive and
I'm still stuck with a potentially stale query if it is not managed
A lot of work for something that can be achieved so easily in a stored
proc.