Select * From (SelectRowNumfield_ByName, d. * From (SELECTb. *, c. loginaccountFROMJITUMS. TB_READERSb, JITUMS. tb_rd_a
Select * From (Select RowNum field_ByName, d. * From (SELECT B. *, c. loginaccount from jitums. TB_READERS B, JITUMS. tb_rd_a
Select * From (Select RowNum field_ByName, d. * From (SELECT B. *, c. loginaccount from jitums. TB_READERS B, JITUMS. tb_rd_account c where B. reader_id = c. reader_id) d Where RowNum <= 10) A Where. field_ByName> = 1;
Select * From (Select RowNum field_ByName, B. * From (SELECT c. name cname, d. loginaccount, e. name from jitums. TB_READERS c, jitums. tb_rd_account d, jitums. tb_rd_type e where c. rdtypecode = e. rdtypecode and c. reader_id = d. reader_id) B Where RowNum <= 10) A Where. field_ByName> 0
Three tables are connected. Two tables have the same column name and must be renamed.C. name cnam
It is usually used during project development. It is impossible to load a large volume of data to the memory at a time. This will use paging, and paging will be used in scope. net Microsoft followers (oh, don't disagree! Java and. net in this industry, the battle of the tongue has not been closed), also use Oracle you said this range query in SQL Server may be better achieved, because it has a Top keyword. this is not to mention, mainly Oracle. oracle has a Rownum keyword. Its function is equivalent to SQL Server's Top. Rownum returns the internal row number of the Table and queries the number of records, its row number will increase from 1 to the last record, and this increment is real-time. therefore, we cannot use the conventional idea to query.
For example, Select * From TableName Where RowNum> = 1000 And RowNum <= 10000 because the record has not been generated, the condition you give does not work at all, so it is null. but there is a solution. We may make a subquery to convert RowNum into usable data.
Select RowNum field_ByName, table_ByName. * From TableName table_ByName and embed it into the following brackets
Select * from (Select RowNum field_ByName, table_ByName. * From TableName table_ByName) A Where A. field_ByName> = 1000 And A. field_ByName <= 10000 this method is easy to understand,
But the efficiency is not high. It queries all the data and then queries the rows between 1000 and 10000 from all the data. According to the Cartesian Product Principle, the redundancy is quite large. there is also a way to improve the preceding SQL, which is much more efficient.
Select * From (Select RowNum field_ByName, table_ByName. * From TableName table_ByName
Where RowNum <= 10000) A Where A. field_ByName >=1000
It can also be written as follows:
SELECT * FROM (select a. *, rownum rn from (SELECT * from jitums. TB_READERS) a where rownum <= 10 where rn> 0