开发者

Select distinct values from multiple columns

开发者 https://www.devze.com 2022-12-31 17:00 出处:网络
I had a table (Some_Table) with two columns: AB ------------------- 1 test 2 test 3开发者_如何学C test1

I had a table (Some_Table) with two columns:

A B

-------------------

1 test

2 test

3开发者_如何学C 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?


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

精彩评论

暂无评论...
验证码 换一张
取 消