Connecting Tech Pros Worldwide Forums | Help | Site Map

Return records 5 thru 10

Familiar Sight
 
Join Date: Sep 2007
Posts: 221
#1: May 14 '09
I realize that mySQL uses the Limit 5,10 type functionality, but I need to retrieve only records 5 thru 10 in my query.

I'm assuming I need to use TOP....

I can do something like this, but I am not going to certainly get the records I need.
SELECT TOP 5 from TABLE order by FIELD DESC

I'm doing this to create some pagination on my web application search results.

Familiar Sight
 
Join Date: Mar 2008
Posts: 141
#2: May 15 '09

re: Return records 5 thru 10


Hey, Try this.

Select Top 5 from Table where Field In(select Top 10 Field from Table order by Field) order by Field Desc
Familiar Sight
 
Join Date: Sep 2007
Posts: 221
#3: May 15 '09

re: Return records 5 thru 10


Thanks that'll do the trick!
Reply