我的查询类似于:
select
name,
color,
min(age) keep (dense_rank first order by priority asc) as age
from
myTable
group by
name,
color
我知道 rank 和 dense_rank 将在分区中返回“重复”值。就我而言,如果优先级在 2 个年龄段之间共享。
那么这条线会做什么:
min(age) keep (dense_rank first order by priority asc) as age
它会为给定的名称、颜色选择优先级最低的行并返回相应的年龄吗?如果有两个具有相同优先级的行,它会随机选择其中一个行吗?