怎么样把求和的值写进一张表中?
select sum(a),sum(b),sum(c) into table1 from table

解决方案 »

  1.   

    这样的话会新建一张表,
    你可以用Insert into table1 Select Sum(a),Sum(b),Sum(C) from table2
      

  2.   

    insert into tbl2 select sum(a),sum(b),sum(c) from tbl1
      

  3.   

    稳妥的写法是insert into tabel1(zd1,zd2,zd3) select sum(a),sum(b),sum(c) from table2 group by d
      d是一个聚合函数的对象
      

  4.   

    怎么样把求和的值写进一张表中?
    select sum(a),sum(b),sum(c) into table1 from table----------------------
    要是你新表已经存在只需要:
    insert into newtable select field1,field2... from oldtable group by
    (你需要注意新表的字段数目和select的字段数目一致)
    要是你表还不存在:
    create table newtable select field1,field2... from oldtable group by
    (这时候只能是你select 的字段,但是有的数据库中不一定可行.)