Hi,
i try to find a query for selecting one arbitrarily chosen row from
each group of rows.
Example:
$ db2 "select * from T"
A B C
----------- ----------- -----------
100 1 10
100 20 2
101 3 3
3 record(s) selected.
The result should be a 'Select A From T group by A' but with one (B,C)-
pair for each group.
So {(100, 1, 10), (101, 3, 3)} and {(100, 20, 2), (101, 3, 3)} would
both be valid results, but not {(100, 1, 2), (101, 3, 3)}.
Is there a way to formulate this in SQL?
Thanks,
Ralf


|