oracle sql wih rownum <= -


why below query not giving results if remove < sign query.because without < must match results?

query used second max id value:

select min(id)  from(     select distinct id      student      order id desc )  rownum <=2 


student id  1 2 3 4 

rownum has special meaning in oracle. increased every row, optimizer knows increasing continuously , consecutive rows must met rownum condition. if specify rownum = 2 never occur since first row rejected.

you can see nice if explain plan on query. show like:

plan rownum <=:

count stopkey        

plan rownum =:

filter 

Comments

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -