views:

422

answers:

2

We have an Interbase 7.1 database and I'm trying to figure out how to limit the number of records returned by the query to just 1. I really only need to know an event code from the last record, in which the query will return hundreds of records if I cannot do some kind of limit.

Thanks in advance!

A: 

Does
http://scott.yang.id.au/2004/01/limit-in-select-statements-in-firebird/
or
http://training.codeface.com.br/?p=182
help?

MSpreij
I've already tried examples using FIRST N SKIP X and I get an error: Dynaic SQL Error, SQL error code = -104, Token unknown
Dragn1821
That is entirely wrong. Firebird and InterBase are not the same.
Craig Stuntz
Hmkay, judging from the contents of those articles, I was hoping they were similar enough, Firebird being a fork of Interbase.
MSpreij
Firebird is a fork of IB, true, but the SQL syntax rules differ in many places, notably this one.
Craig Stuntz
+3  A: 

I think I figured it out. Needed to do something like this...

SELECT * FROM table ORDER BY col ROWS 1

Dragn1821