I need to query an SQL database to find all distinct values of one column and I need an arbitrary value from another column. For example, consider the following table with two columns, key and value:
key value
=== =====
one test
one another
one value
two goes
two here
two also
three example
I wish to get back one sample row, chosen arbitrarily, from each distinct key, perhaps getting these three rows:
key value
=== =====
one test
two goes
three example
How can I formulate such a query in SQL?