nuhusky2003
nuhusky2003

Reputation: 366

Select distinct values from multiple columns

I had a table (Some_Table) with two columns:
A B
-------------------
1 test
2 test
3 test1
4 test1

i would like to return DISTINCT values for column B and it's associated value in column A (first in distinct set), so something like this:

A B
-----------
1 test
3 test1

What is the sql?

Upvotes: 0

Views: 1572

Answers (1)

Mark Baker
Mark Baker

Reputation: 212402

select min(A),B
  from table
 group by B

Upvotes: 7

Related Questions