Well, I am not sure about MS, but in Oracle you have to use the rownum
pseudocolumn and a pseudocolumn, an example:

SELECT * FROM (SELECT * FROM mytable ORDER BY somedatefield) WHERE rownum >
20 AND rownum < 30;

or something like that. It may be similar for MSsql, I am not sure.

Mike

P.S. my example may be wrong, it's been a while since I went to mySQL, and I
have not gone back to Oracle.

-----Original Message-----
From: Michael Marano [mailto:[EMAIL PROTECTED]]
Sent: Thursday, August 15, 2002 2:37 PM
To: [EMAIL PROTECTED]
Subject: LIMITing result sets - Spoiled by MySQL


I am used to working in MySQL, and am now working with MS SQLServer :(
I'm hoping someone else has been in this unfortunate situation before and
can help me out.
I'm looking to do pagination of some resultset in JSP.
in MySQL I would have used something like:

        SELECT * FROM mytable ORDER BY somedatefield LIMIT 20,30

to get the third page of results with 10 results per page.
MSSQL offers me NOTHING as kind as LIMIT.
I have a query that returns ~60,000 results, and I don't want to have to
grab them all on each page,
and then move to the range that I need.

Thanks for the help,

MIchael

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to