简体   繁体   中英

rownum notworking with subquery on oracle

I have a long query with multiple joins,

Select * 
  from (Select firstName, lastname, designation 
          from NameTable nameT 
          left outer join ProfileTable profileT on nameT.id = profileT.id
          where firstName like ("S%") order by firstName ASC
       ) 
  where rownum < 25

The above query works fine, If i change the name search to "sa" then query executing get hanging.

If i change the rownum to 21 "sa" query also gets fast.

Whether we need to add any index to table, or any idea for this question.

Thanks in Advance!!!

why you want to go for subquery here,I think it will help you

  Select firstName, lastname, designation 
   from NameTable nameT left outer join ProfileTable profileT 
   on nameT.column=profileT.column    
  where firstName like ("S%") and rownum < 25

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM