Informix 的 Row_number() 函数
informix 是否有类似于 SQLServer 和 Oracle 的 row_number() 的函数? 我必须使用 row_number()
Between
两个值进行查询,但我不知道如何操作。
这是我在 SQLServer 中的查询:
SELECT col1, col2
FROM (SELECT col1, col2, ROW_NUMBER()
OVER (ORDER BY col1) AS ROWNUM FROM table) AS TB
WHERE TB.ROWNUM BETWEEN value1 AND value2
有帮助吗?
Does informix has a function similar to the SQLServer and Oracle's row_number()
?
I have to make a query using row_number()
between
two values, but I don't know how.
This is my query in SQLServer:
SELECT col1, col2
FROM (SELECT col1, col2, ROW_NUMBER()
OVER (ORDER BY col1) AS ROWNUM FROM table) AS TB
WHERE TB.ROWNUM BETWEEN value1 AND value2
Some help?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您想要获取前 1-100 行,然后是 101-200 行,依此类推,那么您可以使用更直接(但非标准)的语法。其他 DBMS 也有类似的符号,但处理方式略有不同。
要获取第 101-200 行:
您可以使用主变量代替文字 100(或在不同迭代中为占位符使用不同值的单个准备语句)。
If, as it appears, you are seeking to get first rows 1-100, then rows 101-200, and so on, then you can use a more direct (but non-standard) syntax. Other DBMS have analogous notations, handled somewhat differently.
To fetch rows 101-200:
You can use a host variable in place of either literal 100 (or a single prepared statement with different values for the placeholders on different iterations).