取第nextN行的P值用下标索引,取未来nextN行记录中的最大值可以使用dolphindb的eachRight函数和loop函数实现
p = 100..105 nextN = 1 2 3 1 1 1 tb=select * ,p[ nextN + til(p.size())] as nextNp,eachRight(def(x,range)->x.subarray(range).max(), p, loop(pair, 1..p.size(), 1..p.size() + nextN)) as mmaxnextN from table(p,nextN )