Petr Velký
Petr Velký

Reputation: 371

How to limit rows in SELECT with TRANSBASE

I'm working with huge records amount in one table and i need to SELECT them in 50000 pages. Is it possible somehow to limit these pages so the query would be faster and row count will be limited and offsetted?

I'm using ODBC with php like this:

        $odbc_query = "SELECT * FROM " . $table_name;

        $data = odbc_exec($this->odbc_id, $odbc_query);

        while($row = odbc_fetch_array($data))
        {

Upvotes: 2

Views: 5925

Answers (2)

hynekcer
hynekcer

Reputation: 15568

The limit is possible by FIRST(limit):

SELECT * FROM tablename FIRST(1000);

Upvotes: 7

shofee
shofee

Reputation: 2129

u can use limit keyword to limit the number of records...

select * from tablename limit 1000;

this will give u first 1000 rows..

now next time u want next thousand for this u have to keep track of ur last position.

so the query becomes...

select * from tablename limit 1000 offset by lastposition;

Upvotes: 1

Related Questions