删除select中的最后一行

DAR*_*K_A 3 sql oracle select

如何从选定数据中删除最后一行.我需要对数据进行排序并对其进行排序.但最后一行从未使用过.也许有人知道一个例子?

hah*_*ahn 5

你可以试试这个

with t as (select 1 field from dual
union all 
select 2 from dual)

select * from (
  select count(*) over(order by field desc) cnt, t.* from t
) 
where cnt != rownum
Run Code Online (Sandbox Code Playgroud)


Pra*_*ana -1

尝试这样

select * from table
where rowid<>(select max(rowid) from table);
Run Code Online (Sandbox Code Playgroud)

或者

select * from table
minus
select * from table where rownum = (select count(*) from table)
Run Code Online (Sandbox Code Playgroud)