Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 mySQL has LIMIT, what does SQL have?

Author  Topic 

pha2er
Starting Member

6 Posts

Posted - 2002-05-30 : 10:59:18
I have a search page which was running from a mySQL table, using the query

SELECT * FROM table WHERE search = criteria LIMIT 0,10

0 was obviously a variable which I incremented over the result pages, however, it appears LIMIT doesnt work in SQL server 2000, is there anything I replace LIMIT with to make this work?

nr
SQLTeam MVY

12543 Posts

Posted - 2002-05-30 : 11:02:54
There is an article on the site about paging

select top 10 * from tbl order by id

next 10

select * from
(select top 10 * from
(select top 20 from tbl order by id) as a
order by id desc) as b
order by id


==========================================
Cursors are useful if you don't know sql.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -