This query is for calculate group commission and sum all group commission and into a variable.
when SUM(SALAMT)<=1 then SUM(SALAMT)*25/100
when SUM(SALAMT)>=1 AND SUM(SALAMT)<7000 then SUM(SALAMT)*30/100
end) as total into v_group_total
group by commid;
This query is working fine when every group commission level is same but problem created when different group has different commission level.
Please solve my problem.