RE: [PHP-DB] Limiting Sybase Results?
| From: | Matthias Endler | Date: | Thu, 26 Oct 2000 13:22:39 +0000 |
| Subject: | RE: [PHP-DB] Limiting Sybase Results? | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-3942@lists.php.net to get a copy of this message | ||
Hi Stefan,
> hm, we have the problem, that we want to limit the number of rows returned
> by a select. The select statement is like
> "SELECT * FROM anfragen where kid=$subkid order by $sortier desc". We
> search something like the limit - clause of mysql but Sybase
> doesn't support
> this. As a matter of fact Sybase in Version ASE 11.9.2 doesn't support Top
> and first - clause which makes it pretty difficult. We did try it with an
> stored procedure and a cursor, but well we don't get the result sets from
> the cursor...
the only thing coming to my mind at this moment is to use the following:
SET ROWCOUNT 10 -- Ten records will be given back
SELECT * FROM anfragen WHERE kid=$subkid ORDER BY $sortier DESC
SET ROWCOUNT 0 -- Important clear SET ROWCOUNT again,
-- or you'll run into problems later...
Cheers,
Matthias