Hy there,
I have this table
a | b | c |
---|---|---|
One | hello | 1 |
two | hello | 2 |
three | hi | 3 |
four | hi | 4 |
I want to select the minimum "C" value row grouping by B value
my output should be
a | b | c |
---|---|---|
One | hello | 1 |
three | hi | 3 |
How I could select them?
This is typically a solution for row_number
select a, b, c
from (
select *,
Row_Number() over(partition by b order by c) rn
from t
)t
where rn=1
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.