问题描述
informix是否具有类似于SQLServer和Oracle row_number()
的功能?
我必须使用 row_number()
在
两个值之间进行查询,但我不知道如何。
这是我在SQLServer中的查询:
,col2
FROM(SELECT col1,col2,ROW_NUMBER()
OVER(ORDER BY col1)AS ROWNUM FROM table)AS TB
WHERE value1和value2之间的TB.ROWNUM
有些帮助?
解决方案p>如果,如果出现,你正在寻求获得第一行1-100,然后行101-200,依此类推,那么你可以使用更直接(但非标准)语法。
获取101-200行:
SELECT SKIP 100 FIRST 100 t。*
FROM表AS T
WHERE ...其他条件...
您可以使用宿主变量代替字面值100(或在不同的迭代中为占位符使用不同值的单个预准备语句)。
Does informix has a function similar to the SQLServer and Oracle's
row_number()
?I have to make a query usingrow_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?
解决方案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:
SELECT SKIP 100 FIRST 100 t.* FROM Table AS T WHERE ...other criteria...
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).
这篇关于Informix的Row_number()函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!