How can I insert a set of records in an Access tab

2019-08-20 07:04发布

问题:

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 ?