Re: SQL to select a set of records

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Not quite true.

>From the manuals :

The LIMIT clause can be used to constrain the number of rows returned by the
SELECT statement. LIMIT takes one or two numeric arguments. If two arguments
are given, the first specifies the offset of the first row to return, the
second specifies the maximum number of rows to return. The offset of the
initial row is 0 (not 1):
mysql> select * from table LIMIT 5,10;  # Retrieve rows 6-15

If one argument is given, it indicates the maximum number of rows to return:
mysql> select * from table LIMIT 5;     # Retrieve first 5 rows

Luis
----- Original Message -----
From: "Svensson, B.A.T. (HKG)" <B.A.T.Svensson@lumc.nl>
To: <php-windows@lists.php.net>
Sent: Thursday, February 05, 2004 9:57 PM
Subject: RE:  SQL to select a set of records


> You can for instance insert the top 35 into a tmp table, then delete the
top
> 10 with from-from in the temp table, and then finaly select the rest.
>
> Alternative you can select top with decending order form the temp table,
but
> this depends on if you have an ordered set or not of course.
>
> Another possiblility is to define a cursor, and then travers N rows, in
it,
> and then display N:th until the M:th rows, where N is low bondary and M
your
> high bondary.
>
> I hope this gives you some insperation to spinn off with.
>
>
> -----Original Message-----
> From: Herhuth, Ron
> To: php-windows@lists.php.net
> Sent: 5-2-2004 20:58
> Subject:  SQL to select a set of records
>
>
> I am trying to figure out how to bring back only a specific number of
> records using a SQL statement in Microsoft SQL Server.
>
> For example I know how to bring back the first x number of records from
> the database:
> SELECT Top x  * FROM SQLTable
>
> What I would like to do is to bring back only records 25-35 for example.
>
> Is there a way to do this?
>
> Thanks,
> Ron
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux