SQL Query With Row_Number, order by and where clause

后端 未结 5 1855
遥遥无期
遥遥无期 2021-01-21 03:33

I have the following SQL query:

select
     ID, COLUMN1, COLUMN2
from
     (select ID, COLUMN1, COLUMN2, row_number() over (order by 2 DESC) NO from A_TABLE)
whe         


        
5条回答
  •  别那么骄傲
    2021-01-21 03:41

    Check out this Oracle FAQ. In particular this part:

      SELECT * 
      FROM (SELECT a.*, rownum RN 
          FROM (SELECT * 
                             FROM t1 ORDER BY key_column) a
             WHERE rownum <=7)
     WHERE rn >=5
    

提交回复
热议问题