If it helps, this is what I came up with.
but this is too combersome, because it runs each record times each record. So if i'm running it on 100K records, then it's processing it a billion times.
I've tried indexing all the fields, I've also split the Terminal_Name from the table and given it a...