[英]Sql Loader - Loading id's by group data
Hi I have a flat file which gets dumped into a table by using the sql loader. 嗨,我有一个平面文件,该文件通过使用sql加载程序转储到表中。 Lets say I have a records
可以说我有记录
col1 col2 col3 col4
263 Test1 data 1
263 Test2 data 1
264 Test3 data 2
264 test4 data 2
What I am trying to find out is there any way I can assign sequence number by grouping col1. 我试图找出的是我可以通过将col1分组来分配序列号的任何方法。 If the col1 value is the same then all records should have the same value generated by a sequence.
如果col1值相同,则所有记录应具有由序列生成的相同值。 The function
sequence(max,1)
generates the next higher value, but how to group the col1 and then assign the same value to them. 函数
sequence(max,1)
生成下一个更高的值,但是如何对col1进行分组,然后为它们分配相同的值。 Thanks. 谢谢。
You seems want dense_rank()
: 您似乎想要
dense_rank()
:
select *, dense_rank() over (order by col1) as seq
from table t;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.