[英]Your query does not include the specified expression “ID” as part of aggregate function
[英]Access Query + your query does not include the specified expression 'TimeID' as part of the aggregate function
嘗試運行查詢時出現以下錯誤
您的查詢未將指定的表達式“ TimeID”作為聚合函數的一部分
INSERT INTO dwSalesFacts ( FactID, TimeID, CustomerID, EmployeeID, LocationID, ProductID, Quantity, UnitPrice, Discount )
SELECT COUNT(FactID), dwTime.TimeID, Orders.[Customer ID], Orders.[Employee ID], dwLocation.LocationID, [Order Details].[Product ID], [Order Details].Quantity, [Order Details].[Unit Price], [Order Details].Discount
FROM Orders, dwTime, dwLocation, [Order Details];
由於您的SELECT
語句中有COUNT(FactID)
,因此需要指定GROUP BY
如下所示:
GROUP BY dwTime.TimeID, Orders.[Customer ID],
Orders.[Employee ID], dwLocation.LocationID,
[Order Details].[Product ID], [Order Details].Quantity,
[Order Details].[Unit Price], [Order Details].Discount
不知道這是否是您想要的計數分組,但是根據您的選擇,這將是必須的。
如果FactID
是一個自動編號字段,那么您甚至不需要指定它。 請嘗試以下操作:
INSERT INTO dwSalesFacts (TimeID, CustomerID, EmployeeID, LocationID,
ProductID, Quantity, UnitPrice, Discount)
SELECT t.TimeID, o.[Customer ID], o.[Employee ID], l.LocationID,
od.[Product ID], od.Quantity, od.[Unit Price], od.Discount
FROM Orders AS o, dwTime AS t, dwLocation AS l, [Order Details] AS od
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.