Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有兴趣获取特定范围的结果,比如从 99 到 199,或者,也许是最后一个JSON对象。虽然这适用于小数字或范围,但如何将其推广或扩展到更大的范围?
JSON
xquery version "3.0"; for $i in (1,2,3) for $line in db:open("json_people") return $line/json/_[$i]
您可以避免嵌套循环,使用position()函数并指定范围:
position()
db:open("json_people")/json/_[position() = 99 to 199]
您可以在 XQuery 中使用 range,如下所示:
for $i in (99 to 199)