This discussion is archived
9 Replies Latest reply: Nov 21, 2013 9:16 AM by 936666 RSS

Order by col_name + Rownum

936666 Newbie
Currently Being Moderated

I am trying to get the value from a table which if of 1 million records

i need to reterive based on col_name desc or asc and some 10k records in that table

something like this

Select * from 

(Select a.*, rownum as row_num from (SELECT Col_Name1.....Col_Name100 from Mytable order by Col_Name5 desc, Col_Name8 ) a

where rownum  <=10000 ) where row_num >= 1

this query takes more than 10 -15 sec to return the data.

is there a better way to handle this

 

Thanks!

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points