Oracle SQL:如何在行组中区分列值?

时间:2019-05-16 16:13:15

标签: sql oracle

如何使用Oracle SQL进行以下数据转换:

enter image description here

1 个答案:

答案 0 :(得分:1)

您可以轻松地在表示层进行操作,在SQL中,您可以使用row_number()

select (case when row_number() over (partition by colA order by colB) = 1 then colA end) as colA, colB
from table t
order by colA, colB;