如何限制Interbase的7.1返回的记录数?
题
我们有一个Interbase的7.1数据库,我想弄清楚如何限制查询返回的记录数只1.我真的只需要知道从最后一条记录的事件代码,其中查询将返回数百记录,如果我不能做一些限制。
提前感谢!
解决方案
我觉得我计算出来。需要做这样的事情...
SELECT * FROM table ORDER BY col ROWS 1
其他提示
按照接受的答案:
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
这是用于分页的结果尤其方便。
从嵌入式SQL指南在 IB的产品文档页:
不隶属于 StackOverflow