从Progress OpenEdge数据库的表中获取前100条记录(例如SELECT TOP 100 ..) [英] Getting first 100 records from the table in Progress OpenEdge database (e.g. SELECT TOP 100..)
问题描述
如何从Progress OpenEdge数据库的表中获取有限数量的记录?
How can I get a limited number of records from the table in Progress OpenEdge database?
类似于SQL:
SELECT TOP 100 * FROM MyTable
我能找到的唯一丑陋的解决方案是遍历所有记录并在显示100条记录时中断.但是感觉应该有更好的方法.
The only ugly solution I can find is looping through all records and breaking when 100 of them were displayed. But feels like there should be some better way of doing it.
推荐答案
如果您使用的是4GL,则可能还需要考虑使用OPEN QUERY和MAX-ROWS来获得所需的结果.下面显示了一个传统的FOR EACH循环,该循环带有一个计数器,然后是一个具有MAX-ROWS的QUERY:
If you are using the 4GL you might also want to look at using OPEN QUERY and MAX-ROWS to achieve the result that you are looking for. The following shows a traditional FOR EACH loop with a counter and then a QUERY with MAX-ROWS:
define variable i as integer no-undo.
define frame a with 10 down.
for each customer no-lock break by name:
i = i + 1.
display i custNum name discount.
if i >= 5 then leave.
end.
define query q for customer scrolling.
open query q for each customer no-lock break by name max-rows 5.
do i = 1 to 5 with frame a:
get next q.
display i custNum name discount.
end.
这篇关于从Progress OpenEdge数据库的表中获取前100条记录(例如SELECT TOP 100 ..)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!