Re: "LIMIT" problem MSSQL

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

 



a solution offered i received from "raydan

Untested:
Untested:
declare @num int
set @num = 20

EXEC ('select top 10 from myTable
   where ID not in (select top ' + @num + ' from myTable order by ID)
    order by ID')

But beware the dangers of dynamic SQL.



"Mark Snijders" <Mark.Snijders@atosorigin.com> wrote in message
1E89D877173CD311B9510008C75D97B20941D836@nlehx021.nl.int.atosorigin.com">news:1E89D877173CD311B9510008C75D97B20941D836@nlehx021.nl.int.atosorigin.com
...
> $start = 10;
>
> $numbers_to_show = 25;
>
> $sql = "SELECT * FROM bla Limit $start, $numbers_to_show";
>
> or just go to mysql.com and use the manual :)
>
> -----Original Message-----
> From: Noam Giladi [mailto:noam@i-com-it.com]
> Sent: woensdag 19 februari 2003 16:00
> To: php-db@lists.php.net
> Subject:  "LIMIT" problem MSSQL
>
>
> I'm trying to split results into different pages and number the pages
> accordingly.  I've been able to build a fairly intelligent page numbering
> system which knows which rows it should pull (at least by numbering each
row
> numerically) but I don't know how to construct a SQL query to pull 10
> results starting at a certain number.
>
> please  did anyone wrote a proc that do it?.
>
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>



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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux