0

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?

2
  • In this example, there are two first column values for each second column. You want only the least value for each second column value? Commented May 18, 2010 at 14:09
  • You have a good answer by Mark below, only a note here; saying first in distinct set is wrong. sets are unordered, if you want to talk about order you have to specify in respect to what (own value, some other columns value, etc...) Commented May 18, 2010 at 14:39

1 Answer 1

7
select min(A),B
  from table
 group by B
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.