ober Posted April 27, 2006 Share Posted April 27, 2006 I know you can use the LIMIT clause in MySQL to grab a specific group of records from a MySQL table, but I'm using MSSQL and I need to do the same thing. I know about the TOP function, but I'm not sure how to go about grabbing the TOP x records starting at record y.I have groups of 12000+ records in a table and I'm graphing all the records. They will have the option to zoom in on the graph and I need to be able to go back and grab from x to y.Any ideas? The only other thing I was thinking of was doing some math on the ID value (auto-increment). Quote Link to comment Share on other sites More sharing options...
ober Posted April 28, 2006 Author Share Posted April 28, 2006 Just in case anyone else ever digs this thread back up or searches for it, I did find an answer:[a href=\"http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=850&lngWId=5\" target=\"_blank\"]http://www.planet-source-code.com/vb/scrip...Id=850&lngWId=5[/a]I modified it to fit my application and it works like a charm. Obviously it's very bloated compared to the LIMIT clause, but it works. Quote Link to comment Share on other sites More sharing options...
Barand Posted April 28, 2006 Share Posted April 28, 2006 Also to emulate LIMIT 20,10[code]SELECT TOP 10 * FROM mssqltableWHERE id NOT IN (SELECT TOP 20 id FROM mssqltable)[/code] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.