Oracle sql每行生成连续数字
我有一个带有 seqno 列的表。我想基于此创建另一列 (grpseqno),其编号仅从 1 到 3,如下所示。如果这是由 Oracle sql 创建的,那就太好了。先感谢您。
seqno grpseqno
1 1
2 2
3 3
4 1
5 2
6 3
7 1
我似乎无法从 1 循环到 3
I have a table with a seqno column. I would like to create another column (grpseqno) based on this which is numbered from 1 to 3 only as shown below. It would be neat if this is created by Oracle sql. Thank you in advance.
seqno grpseqno
1 1
2 2
3 3
4 1
5 2
6 3
7 1
I cannot seem to get to cycle from 1 to 3
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
一种选择可能是这样的
case
表达式:示例数据:
查询从这里开始:
One option might be such a
case
expression:Sample data:
Query begins here: