View Single Post
Old 01-10-08, 06:23 PM   #1
technoid
Registered User
 
Join Date: Jul 2004
Location: Denton, Texas
Posts: 505
Default MySQL SORT by Column and LIMIT Rows using classic ASP

I started to add paging code to my project at work and I can't seem to get sorting and paging to work at the same time. I'll put the querries below for them separately but how do I start at a row offset and sort too.

Example: 50 Rows in table
I want to start at row 0, 10, 20, 30, 40 and display 10 rows but also sort them by any column. Here's the two querries I used before I tried to add paging and just tried to add display row offsets. That works but I can't seem to get the right combination to get paging and sorting together. I'm using classic ASP to write the code.

Quote:
QUERRY TO LIMIT ROWS
Set oRS = oConn.Execute("SELECT * FROM `tracking` LIMIT " & startRecord & "," & endRecord)
Quote:
QUERRY TO SORT BY ONE OF THE COLUMNS IN THE TABLE
Set oRS = oConn.Execute("SELECT * FROM `tracking` ORDER BY `model`")
Thanks for any help.
__________________
Antec-SOLO | ASUS-P5Q-SE | C2D-E8600 | AC-Freezer-7-Pro | Seasonic-S12-550W | 3GB-KVR-PC2-6400 | GTX-560Ti | SB-XtremeGamer | Pioneer-BDR-205 | Samsung-S223B | Dell-U2412M
technoid is offline   Reply With Quote