Image courtesy of stockimages at

I got stuck writing a query for Firebird today. This is not the first time that the SQL was a standard has not been so standard — if only the “S” were for “Standard”…

I was busy writing scripts at work to paginate results in our BI portals. In MySQL I would usually write something like this to return the first 20 records:

SELECT * FROM `table` LIMIT 1, 20;

Not so in Firebird:

SELECT FIRST 20 SKIP 0 * FROM `table`;

In the MySQL, the 1 denotes from which record to start, and the 20 how many records to return. In the Firebird syntax, the FIRST denotes the number of records to return, and the SKIP specifies from which record to start.

Naturally, to effect the pagination, you would use variables passed between the pages to control moving between sets of records.

The support for Firebird is nothing like that for MySQL — and it took me quite a while to find the answer. Sometimes the geeks disappoint…

By foxbeefly

PHP / MySQL Developer. HTML, CSS and some JavaScript.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.