请参见下面的示例。如果 id, A, B, D 与其他记录相同,则 union 和 sum 列 "C" 。
my data:
id A B C D
---------------------------
1 1 2 3 4
2 aa bb 10 dd
3 1 2 3 4
4 1 2 3 4
2 aa bb 30 dd
how to do after like below result:
id A B C D
---------------------------
1 1 2 3 4
2 aa bb 40 dd <----if id,A,B,D are same with other records,then union and sum column "C"
3 1 2 3 4
4 1 2 3 4
I tried to union all records,but fail and show"
id A B C D
---------------------------
2 aa bb 49 dd