Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi need to auto generate ids based on the numbers like
Examples
slno, num, Autogerate
1, 1 , 1
2, 1, 2
3, 23, 1
4, 23, 2
5, 23, 3
6, 23, 4
7, 12, 1
8, 12, 2
9, 15, 1
If u noticed autogerate column
for first two common numbers 1,2 and next 3 to 6 slno should repeated numbers 1,2... similarly so on , im wondering ill get any help
Easier way should be like:
Load
slno,
num,
Autonumber(slno,num) as AutoGenSeq
...
temp:
load slno, num
resident your table order by num asc;
load * , if (rowNo() = 1 or num<> previous(num),1,peek(Autognerate) + 1) as AutoGenerate
resident temp;
drop table temp;
Hi,
Try this ways
LOAD
slno, num, Autogerate,
if(num = Previous(num),Peek(Num)+1,1 ) as AutogerateNew;
LOAD * INLINE [
slno, num, Autogerate
1, 1, 1
2, 1, 2
3, 23, 1
4, 23, 2
5, 23, 3
6, 23, 4
7, 12, 1
8, 12, 2
9, 15, 1
];
And you get this table fields
Regards
Anand
Easier way should be like:
Load
slno,
num,
Autonumber(slno,num) as AutoGenSeq
...