问题描述
假设我有以下记录:
code sequence_no group_no
4 1 1
2 2 1
3 3 1
4 4 1
1 1 2
3 1 3
4 2 3
输出应为:在同一组中(按group_no),代码列将更新为第一个非4的(by sequence_no)代码。
因此输出应如下所示:
code sequence_no group_no
2 1 1
2 2 1
2 3 1
2 4 1
1 1 2
3 1 3
3 2 3
这是我的代码,我的逻辑是,如果input.code == 4,则将下一个代码分配给temp变量。如果第一个记录代码== 4,由于某种原因,这将不起作用。而且我认为如果== 4,这个逻辑就不会覆盖该组的最后一条记录。
type temporary_type=
record
decimal("\x01") l_code;
end;
temp :: scan(temp,in) =
begin
temp.l_code::
if (temp.l_code == 4) in.code
else temp.l_code;
end;
temp :: initialize(in) =
begin
temp.code :: in.code;
end;
out :: finalize(temp,in) =
begin
out.* :: in.*;
out.code :: temp.l_code;
end;
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)