发布网友
共3个回答
热心网友
查询第三大值:select A, max(B) as thirdB from test
where B not in (select top 2 B from test order by B desc)
--这里就把第一、二大的数去掉了
group by A;
热心网友
SQL Server / Oracle 的话,很好处理。
一个 ROW_NUMBER() OVER(PARTITION BY A ORDER BY B DESC) 一下。
然后这个数字 = 3的, 就是分组第三大值了。
MySQL 不知道支持不支持追问可惜Mysql不支持
热心网友
写自定义函数吧