没用过Oracle,如果是SQL Server的话可以这样试试:select id,sum(a) as a,sum(b) as b,sum(c) as c into table2 from table1 group by id
若我再加一个字段name后呢?如: Table1: id name a b c 1 test 1 2 3 2 water 3 2 1 2 test 2 3 1 2 water 1 2 3统计Table2: id name a b c 1 test 1 2 3 2 water 4 4 4 2 test 2 3 1这个又如何统计呢?
Table1:
id name a b c
1 test 1 2 3
2 water 3 2 1
2 test 2 3 1
2 water 1 2 3统计Table2:
id name a b c
1 test 1 2 3
2 water 4 4 4
2 test 2 3 1这个又如何统计呢?