pg9.5 upsert 实际运用 求指导
想把 kjb 对应的 am t金额 根据 scale 的占比 分到amt01 上,
rc1 =分摊amt 金额 对应的 rc 用这个新功能能实现吗?
create table test(
RC VARCHAR(20) primary key,
GLID VARCHAR(20),
CURR VARCHAR(20),
amt decimal(18,6),
AMT01 decimal(18,6),
acctnum VARCHAR(10),
SCALE integer,
rc1 VARCHAR(20))
insert into test values ('kjb',0000,01,100000,null,null,null,null);
insert into test values ('a',0001,01,null,null,'a',10,null);
insert into test values ('b',0001,01,null,null,'b',40,null);
insert into test values ('c',0001,01,null,null,'c',30,null);
insert into test values ('d',0001,01,null,null,'d',20,null);
把kjb对应的100000 根据 scale的占比 分摊到amt01 字段上,rc1 对应 分摊金额对应的 rc
急急急,求大神指导怎么写