sql返回第n大的数的聚合函数类似max、min
发布网友
发布时间:2022-04-14 05:31
我来回答
共1个回答
热心网友
时间:2022-04-14 07:00
1. Oracle
select rownum rw,tt.* from
(select unique t.myField from mytable t
order by t.myField desc) tt
where rw = 3;
2. SQL Server
select row_number() rw,tt.* from
(select unique t.myField from mytable t
order by t.myField desc) tt
where rw = 3;