How can I insert a set of records in an Access table which come from an aggregate query

别等时光非礼了梦想. 提交于 2019-12-24 18:55:28

问题


MS Office 365 ProPlus, Access 2007 - 2016

I'm trying to insert a set of records into a table using an insert statement feeding out of a select statement. Here is what I'm trying...

insert into BurnDownMetrics
  (day,project,domain,tot_effort_spent,tot_effort_left,tot_est_effort)
SELECT Date() AS Expr1, 
       ardmerspk.project, 
       ardmerspk.domain, 
       Sum(ardmerspk.effort_spent) AS SumOfeffort_spent, 
       Sum(ardmerspk.effort_left) AS SumOfeffort_left, 
       Sum(ardmerspk.tot_effort) AS SumOftot_effort
FROM ardmerspk
GROUP BY ardmerspk.project, ardmerspk.domain;

The subquery alone (the "SELECT Date() ...") works great when I test this in a "Create Query Design". It returns the set of about 20 records exactly as I would expect. But when I try to feed that into the insert statement, it inserts one row only.

The "Date()" col is a bit unusual. But it doesn't seem to bother the query when that is run alone.

Any idea what's wrong with this ?

来源:https://stackoverflow.com/questions/54488047/how-can-i-insert-a-set-of-records-in-an-access-table-which-come-from-an-aggregat

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!