Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
My data set looks like this.
ID | CUST | CITY |
ID-1 | C | CTY-1 |
ID-1 | C-1 | CTY-1 |
ID-2 | C-2 | CTY-2 |
ID-3 | C-3 | CTY-3 |
ID-4 | C-3 | CTY-4 |
I need to write a load script that adds a row# column to this table in the following manner.
ID | CUST | CITY | ROW# |
ID-1 | C | CTY-1 | 1 |
ID-1 | C-1 | CTY-1 | 2 |
ID-2 | C-2 | CTY-2 | 1 |
ID-2 | C-3 | CTY-3 | 2 |
ID-4 | C-3 | CTY-4 | 1 |
The ROW# grows sequentially for the same ID and then restarts for each new ID as shown in the table above.
Thanks,
Try using second parameter in autonumber() like:
Autonumber(RowNo(), ID) as Increment
thanks for the answer but this may not work for me.
it autogenerates the ID in a sequence but I need to restart the number for a new ID the way I have shown in the second table.
Try using second parameter in autonumber() like:
Autonumber(RowNo(), ID) as Increment
Just adding Help link to AutoNumber():
Regards,
Brett