Board index » delphi » How emulate MySQL LIMIT clause in Oracle / SQL-Server

How emulate MySQL LIMIT clause in Oracle / SQL-Server

How do I emulate the MySQL LIMIT clause (SELECT ... LIMIT 10,20) in oracle /
sql-server?

Frank

 

Re:How emulate MySQL LIMIT clause in Oracle / SQL-Server


Oracle:
select * from (subquery) where rownum between 10 and 20;

Quote
"Frank. C." <gche...@nospam.hotmail.com> wrote in message

news:3d18c539_2@dnews...
Quote
> How do I emulate the MySQL LIMIT clause (SELECT ... LIMIT 10,20) in oracle
/
> sql-server?

> Frank

Re:How emulate MySQL LIMIT clause in Oracle / SQL-Server


Any idea for SQL-Server?

Quote
> Oracle:
> select * from (subquery) where rownum between 10 and 20;

> "Frank. C." <gche...@nospam.hotmail.com> wrote in message
> news:3d18c539_2@dnews...
> > How do I emulate the MySQL LIMIT clause (SELECT ... LIMIT 10,20) in
oracle
> /
> > sql-server?

> > Frank

Re:How emulate MySQL LIMIT clause in Oracle / SQL-Server


Quote
"Frank C." <gche...@nospam.hotmail.com> wrote in message

news:3d1a6c36_2@dnews...

Quote
> Any idea for SQL-Server?

I beleive MSSQL supports TOP nn

--
Wayne Niddery (Logic Fundamentals, Inc.)
RADBooks: http://www.logicfundamentals.com/RADBooks/delphibooks.html
Those who disdain wealth as a worthy goal for an individual or a society
seem not to realize that wealth is the only thing that can prevent
poverty. - Thomas Sowell

Re:How emulate MySQL LIMIT clause in Oracle / SQL-Server


To fully answer Frank's question, you'll probably need a subquery to limit
the results to not include the top 10 if you want 10 through 20:

select top 20 * from some_table where table_key not in (select top 10 key
from some_table)

Eric

Other Threads