Consider table tblA to the left. Each ID has rows 1 to 6. For each ID, the 6 values of
valx and valy form 3 matching pairs, each written both 'forwards' and 'backwards'.
For ID = 91, the three matching pairs are (24, 19), (18, 20), (21, 16).
I want to get output like the table tblB shown at right. This shows the row values
corresponding to the matched pairs. To avoid duplicates, I keep rowx < rowy.
Code:
tblA tblB
ID row valx valy ID rowx rowy
-------------------------- ---------------------
91 1 24 19 91 1 3
91 2 18 20 91 2 6
91 3 19 24 91 4 5
91 4 21 16
91 5 16 21 92 etc...
91 6 20 18
92 1 21 16
92 2 20 18
... etc...
Many thanks for any clues. My coding is a bit rusty, and I just can't get this to work.
Teach314