这是我的数据样本
select * from (
select 'A' as POD, 164 as result from dual union all
select 'A' as POD, 3 as result from dual union all
select 'A' as POD, 2 as result from dual union all
select 'B' as POD, 409 as result from dual union all
select 'B' as POD, 128 as result from dual union all
select 'B' as POD, 5 as result from dual union all
select 'C' as POD, 12391 as result from dual union all
select 'C' as POD, 624 as result from dual union all
select 'C' as POD, 405 as result from dual union all
select 'C' as POD, 26 as result from dual union all
select 'C' as POD, 3 as result from dual union all
select 'C' as POD, 2 as result from dual
)
荚 | 结果 |
---|---|
一个 | 164 |
一个 | 3 |
一个 | 2 |
乙 | 409 |
乙 | 128 |
乙 | 5 |
碳 | 12391 |
碳 | 624 |
碳 | 405 |
碳 | 二十六 |
我想要的是按照首次计数最高的组对它们进行排序:
荚 | 结果 |
---|---|
碳 | 12391 |
碳 | 624 |
碳 | 405 |
碳 | 二十六 |
乙 | 409 |
乙 | 128 |
乙 | 5 |
一个 | 164 |
一个 | 3 |
一个 | 2 |
我甚至不知道如何用 SQL 来表达这个
C
result
在第一行中具有最高值,然后B
具有第二高值A