Re: MSSQL Top Option in Query
| From: | Thomas | Date: | Thu, 02 Nov 2000 12:28:16 +0000 |
| Subject: | Re: MSSQL Top Option in Query | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-3637@lists.php.net to get a copy of this message | ||
Hello Flint,
maybe my substitute for the MySQL "LIMIT" helps you to get a solution:
*snip*
$check = "SELECT TOP $limit WITH TIES * FROM $table where ID not in (SELECT
TOP $offset WITH TIES ID FROM $table ORDER BY $mySort1 ASC, ID ASC) ORDER BY
$mySort1 ASC, ID ASC;";
*snip*
It's more complicated than with mySQL, but it works.
Best regards,
Thomas
Flint Doungchak wrote:
> Hi,
>
> I was wondering if their is a similar command in MS SQL as I have found in
> MySQL.
>
> With MySQL, I use
>
> "SELECT * FROM blah start(5,10)"
>
> That would spit back 5 rows, starting at the 10th row.
>
> However, in MS SQL, I have to use the top attribute which spits back the top
> n rows. I want to be able to specify that second attribute of what row to
> start at.
>
> "SELECT top 5 FROM blah"
>
> doens't exactly get what I want. I'm trying to get the next n rows on n
> pages type thing on a page I'm developing. Any ideas.
>
> -Flint
>
> _________________________________________________
> Flint Doungchak
> Net Solutions, LLC
> 840 Lawrence Street
> Eugene, OR 97401
> flint@netsolutionsllc.com
> Voice +1 541 345-7087
> Fax +1 541 485-5519
> http://www.netsolutionsllc.com
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-windows-unsubscribe@lists.php.net
> For additional commands, e-mail: php-windows-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net