How to get 2nd Highest Salary in Abinitio | get nth highest salary


Watch my YouTube video for explanation :



Please look into the class notes here for your references:

how to get 2nd highest value in group by customer id?

I/P -> SORT within Group {Customer id and minor-key Amount desc)-> 
   -> SCAN and create one more field as sequence id(output-select)->O/P


INPUT ==>  SORT ==> SCAN (Key=Customer id) ==> Output

type temporary_type=
begin
decimal("") sequnce_id;
end;

temp::initialize(in)=
begin
temp.sequnce_id::0;
end;

out::scan(temp,in)=
begin
out.sequnce_id::temp.sequnce_id +1;
end;

out::finalize(temp,in)=
begin
out.*::in.*;
out.sequnce_id::temp.sequnce_id;
end;
sequence_id
1  - for the max trasaction value
2  - 2nd highest
3  - 
4  -


out::output_select(in)=
begin
out.*::if(in.sequnce_id==2)in.*;
end;

Fore more Abinitio, AWS and data engineering videos please subscribe , view , like and share my YouTube channel 

Click DataPundit

Comments

Popular posts from this blog

Abinitio Interview Question # 1 - Write Multiple Files in Abinitio

Next In Sequence in ABinitio | How next_in_sequence() works in MFS