我有一个包含3列的表格,如下所示:
Col1 col2 col3
101426 101426 40
101426 101426 49
101426 101426 80
101441 101441 30
101441 101441 40
101441 101441 49
101441 101441 80
101582 101582 49
101582 101582 80
101612 101612 80
101693 101693 31
101693 101693 40
101693 101693 80
101796 101796 80
101865 101865 30
101865 101865 40
希望获得以下记录,这是col1
和col2
101426 101426 40
101441 101441 30
101582 101582 49
101612 101612 80
101693 101693 31
101796 101796 80
101865 101865 30
答案 0 :(得分:1)
我不确定我的问题是否正确,但不应该做以下工作?
SELECT Col1,Col2, MIN(col3)
FROM myTable
GROUP BY Col1,Col2
答案 1 :(得分:0)
试试这个,
Select * from (
select *,
ROW_NUMBER() over (partition by col1 order by col1 asc ) as a
from A
)myTable
where a = 1