Select n-1 query strings

I offended 11g. Suppose the following query returns n rows.

SELECT t.id,t.from_date,t.price FROM prices t order by id, date 

And I want only the first n-1 lines from the query. How can I do this without using internal queries?

+4
source share
1 answer

EDIT : modified based on additional information added to the question.

 select p.id, p.from_date, p.price from (select id, from_date, price, row_number() over (order by id desc) as r from prices) p where pr <> 1 order by p.id, p.from_date 
+5
source

Source: https://habr.com/ru/post/1338888/


All Articles