怎么做行号查询 [英] how to do row number query

查看:90
本文介绍了怎么做行号查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用sql查询打开一个结果集,比方说我希望光标

指向我开头的任何位置给出一个行号,所以是

无论如何我可以使用sql函数来做到这一点,所以当

结果集返回时,第一行将是绝对行dertermine由

行号

解决方案

xixi写道:

我想用sql查询打开一个结果集,说我想要光标<通过给出一个行号指向我开始的任何位置,所以是无论如何我可以使用sql函数来做到这一点,所以当
结果集返回时,第一行将是绝对行dertermine由行号




我不明白你的问题,但你可以使用row_number()函数

为结果集中的每一行添加一个唯一的数字。


-

Knut Stolze

信息n整合

IBM德国/耶拿大学


xixi写道:

我想用sql查询打开一个结果集,说我希望光标指向我通过给出行号开始的任何位置,所以是无论如何我还可以使用sql函数来做到这一点,所以当
结果集返回,第一行将是绝对行dertermine的行号




我不明白你的问题,但是你可以使用row_number()函数

为结果集中的每一行添加一个唯一的数字。


-

Knut Stolze

信息集成

IBM德国/耶拿大学


同时查看可滚动游标 。


干杯

Serge

-

Serge Rielau

DB2 SQL编译器开发

IBM多伦多实验室

i want to use sql query to open a resultset, say i want the cursor
point to whatever position i start with by giving a row number , so is
there anyway i can use the sql function to do that, so when the
resultset return, the first row will be the absolute row dertermine by
the row number

解决方案

xixi wrote:

i want to use sql query to open a resultset, say i want the cursor
point to whatever position i start with by giving a row number , so is
there anyway i can use the sql function to do that, so when the
resultset return, the first row will be the absolute row dertermine by
the row number



I don''t understand your question, but you can use the row_number() function
to add a unique number for each row in the result set.

--
Knut Stolze
Information Integration
IBM Germany / University of Jena


xixi wrote:

i want to use sql query to open a resultset, say i want the cursor
point to whatever position i start with by giving a row number , so is
there anyway i can use the sql function to do that, so when the
resultset return, the first row will be the absolute row dertermine by
the row number



I don''t understand your question, but you can use the row_number() function
to add a unique number for each row in the result set.

--
Knut Stolze
Information Integration
IBM Germany / University of Jena


Also look into "scrollable cursors".

Cheers
Serge
--
Serge Rielau
DB2 SQL Compiler Development
IBM Toronto Lab


这篇关于怎么做行号查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆