2009-06-24 61 views
5

我们有一个Interbase 7.1数据库,我试图弄清楚如何将查询返回的记录数限制为1.我真的只需要知道最后一条记录中的事件代码,其中查询将会如果我不能做某种限制,会返回数百条记录。如何限制为Interbase 7.1返回的记录数量?

在此先感谢!

回答

11

我想我想通了。需要做这样的事情...

SELECT * FROM表ORDER BY山坳出行1

4

按照接受的答案:

SELECT * FROM table ORDER BY col ROWS 1 

将仅返回一个结果。 还有其他几个行限制方案可供选择:

 
ROWS n  Returns the first n rows of the result set, or n percent if used with PERCENT 
ROWS m TO n Returns rows m through n, inclusive or the mth to nth percent 
ROWS n BY p Returns every pth row of the first n rows 

这是分页结果特别方便。

来自InterBase Product Documentation的嵌入式SQL指南页面:

相关问题