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)
 Getting records 21-30 etc...

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-07-26 : 09:00:48
Colin writes "Hi, I used some code on your site and modified it so it worked for me. What I want to do is have page on my site that starts by displaying records 1 - 10 of X , then you can click a button to go to 11-20 of X etc...

The code I have is this:

SELECT * FROM Countries
WHERE (name IN
(SELECT TOP 10 name
FROM Countries
WHERE (name IN
(SELECT TOP 3000 name
FROM countries
ORDER BY NAME))
ORDER BY name DESC))
ORDER BY name

The problem I have is that When it gets to the last records, if there are 31 records, it will display records 21-31 of 31, not 31-31 of 31. The code would display 20-30 prior to displaying 21-31 which looks very unprofessional. Thanks for any help,

Colin Nederkoorn

P.S. SQL Server 2000, PHP, Apache."
   

- Advertisement -