Let's see if we understand this now:
>I may have a result like this:
>
>000001 000002
>000032 000003
>000034 000003
>000004 000002
>000005 000002
>000056 000003
The first SQL SELECT I gave you would produce this from those numbers:
000001 000002
000032 000003
>So, the final result should be:
>000001 000002
>000003 000003
So you want to extract from the first result set:
1) the MIN of pk & sk for the first column
2) and the exact value of sk for column2?
If so, this combination should do it (note slight change in first SQL)
SELECT MIN(PrimaryKey) AS pk, SecondaryKey AS sk ;
FROM Table INTO CURSOR TEMP ;
GROUP BY 2
SELECT EVAL("MIN(pk,sk)") AS pk, sk FROM temp