when i used gen_row_num_by_group() i am getting the groupid data in the below table order,but i would like to get the groupID data in the above given table order.
gen_row_num() doesn’t need a column as parameter, that wouldn’t make much sence since it’s just enummerating all rows.
gen_row_num_by_group(TRID) is correct though. And you need to sort by TRID in a query before that. But I guess you have figured that out already since you tested that function before your first post.
edit: I should read the examples more carefully. My “Formula” won’t give you what you want since the output would be
If you want to get to your solution youll need to Split your input, do a distinct TRID and gen_row_num() as output in on one branch and join back to the other branch on TRID
I would think of writing a Custom Function which uses the previous_row_value() function on a sorted source data (Sort Order : TRID, RID)
–> Assign a Counter with value 1
–> Whenever the TRID changes, increment the counter
–> If it don’t change by comparing TRID = previous_row_value(TRID) then don’t increment
When I am trying to use previous_row_value() function on grouped and sorted data in Custom function, it says we cannot use this function. If you could guide me how I can access previous row value in custom function with or without using Previous_row_value() would be very helpful.