Let’s say that I have 2 columns:
_______________
| id1 | id2 |
|------|------|
| 1 | 2 |
| 2 | 1 |
| 3 | 4 |
| 4 | 1 |
| 4 | 3 |
| 1 | 4 |
...
If I have a row id1 = 1 and id2 = 2, there will be a row somewhere after it which will be id1 = 2 and id2 = 1.
How can I get the top of each (id1, id2) pair?
Update:
The result from the example should be:
row1: 1 | 2
row2: 3 | 4
row3: 4 | 1
Linking back to the original table depends a lot on what is in that table that causes the order. Lets says you have a date field or a sequence field and you want the smallest value…
In this example I assume seqField is unique by row
Then it looks like this:
This gives
As sqlchan points out seqField can be replaced with
%%physloc%%if you don’t have an existing column to use.