Re: (OT) MSSQL - get records #n...n+10?
| From: | Joe Conway | Date: | Thu, 14 Dec 2000 04:24:47 +0000 |
| Subject: | Re: (OT) MSSQL - get records #n...n+10? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-30240@lists.php.net to get a copy of this message | ||
> You could use a SET ROWCOUNT 10 as the first statement in your query. This
way you will only get the first 10 rows of the result. You woyld need to
adjust the WHERE clause of the next SQL statement to get the next 10 rows.
>
> - Frank
>
> >Hi, just wondering, is there an easy way in MS-SQL to get records
> >#n...#n+10 like mysql's limit keyword?
> >
If you have MSSQL 7, the first call you can use:
select top 10 field1, field2, ... from tablename order by field1
then use:
select top 10 field1, field2, ... from tablename where field1 >
$YourLastRoundMaxField1 order by field1
Hope this helps,
Joe