这是示例查询:
payment_Type    payment_value       cost_type      cost value
Cost I          100                 Registration       40
Cost I          100                 books              40
Cost I          100                 Lab                40
COST I有 3 个元素,Cost_Type它们都有自己的Cost_value.     
我想这样操作:
payment_Type    payment_value       cost_type      cost value     Payment_by_cost_type
Cost I          100                 Registration       40              40
Cost I          100                 books              40              40
Cost I          100                 Lab                40              20
关键是我想把它分成payment_value每个cost_value。在示例中,payment_by_cost变为 40、40、20 = 100。
实验室cost_value是 40,但它可以分配值是 20,因为上面的分割 2 成本类型仍然存在。
我可以使用Payment_by_cost_type下一行记录中的值吗?我一直在尝试将值插入Payment_by_cost_type到临时表中,但 select 不能有 insert 语句。
有没有人对如何解决这个问题有任何想法?我一直在咨询 DWH,他说它必须使用无法通过查询完成的 Store 过程。