Because rownum of Oracle is a pseudo column, if it is used, it must be queried to display the mark, for example, marked as num in this SQL statement.
It is worth mentioning that the inmost query SQL: "SELECT. group specification code... "itself has a rownum, and then rename the query statement result with the rownum as num column as the table temptable. At this time, the table temptable also has a new rownum.
I marked the new rownum as num, and then I can query any data row I want to use.
Not to mention directly accessing SQL:
Select TB. * from
(
Select rownum as num, temptable. * from
(
Select rownum as RN,. group specification code: bianma,. ID,. IPaddress portipaddress,. maskaddress,. lastoperstatus,. laststatustime,. description,. portnum,
A.ifspeed,a.tar get_id,. ifname,. portdesc,. isfree, B. name devicename, B. node_id, D. name as divecetype, B. IPaddress, B. deep,. ifindex
From smartidc.tar getsport
Left join smartidc.tar gets B on a.tar get_id = B. ID
Left join smartidc. B _nodes C on B. node_id = C. nodeid
Left join smartidc. d_configtree D on B. configtree_id = D. id where 1 = 1
Order by B. Name, A. portnum, A. isfree DESC
)
Temptable
) TB
Where num> 10 and num <= 20;
Using rownum to implement real Paging