with your_table(entity, attribute) as (
select 'a', 'Car'
union all select 'a', 'Car'
union all select 'a', 'Bus'
union all select 'b', 'Car'
union all select 'b', 'Cycle'
union all select 'C', 'Car'
union all select 'D', 'Bus'
union all select 'D', 'Motocyle(?)'
union all select 'D', 'Car'
union all select 'a', 'Cycle'
)
select
dense_rank() over (order by entity) as ID,
entity,
attribute
from your_table
1条答案
按热度按时间ccrfmcuu1#
我相信您正在寻找
DENSE_RANK()
dbfiddle