I heard that SQL Server and MySQL have top keywords and can return the first N records of sorting records. For example, select top 10 * From table_name order by col_name. I think Oracle must have similar functions, oracle uses the rownum keyword instead of the top keyword.
To retrieve the Top N records from a query, you can use the following syntax:
Select *
From (your ordered query) alias_name
Where rownum <= rows_to_return
Order by rownum;
Write the following query statement according to the above Syntax:
Select * from (select rownum from gzl _ process flow status order by process instance number) kk where rownum <= 10 order by rownum;
Sort the gzl _ flow status table by process instance number and then return the first 10 rows. To return the last 10 rows, you only need to sort them in descending order. This is easy to think. Kk is the alias of A subquery.
Select title, art_id, reader_count
From (select title, art_id, reader_count
From article
Where (sys_cat <> 'new') and (eff_status = 'A ')
Order by reader_count DESC)
Where (rownum <= 3)
Order by rownum ASC