如何用ADO或DAO汇总ACCESS数据库在线等!
如:我有一个名为temp的access数据库,存里有一个表名为temp
有三个字段pl,int add
pl int add
----------------
苹果 3 15
----------------
香蕉 4 16
----------------
雪梨 10 30
----------------
苹果 5 25
----------------
雪梨 5 15
----------------
苹果 2 10
----------------
我要做出汇总出来的结果:
并生成另一个表名为temp1的新表
pl int add
----------------
苹果 10 50
----------------
香蕉 4 16
----------------
雪梨 15 45
最好用ado或dao
其它方法都可以只要能做到就ok
推荐阅读
这回正确了
dim conn as new adodb.connection
ss.connectionstring = "provider=microsoft.jet.oledb.4.0;data source=" + app.path + "\temp.mdb;"
ss.open
ss.execute "select pl,sum(int),sum(add) into " + app.path + "\savedb.tablename from temp group by pl"
ss.close
set ss = nothing
前提是这个temp.mdb和savedb.mdb已经存在,而tablename这个表是不存在的,就是你要从新建立的那个表,也可以保存到同一个数据库里
ss.execute "select pl,sum(int),sum(add) into " + app.path + "\temp.newtbl from temp group by pl"
终于可以接分了,哈哈


讨论区