我试图在表中插入2个计数作为一个通过vba访问的记录,并且由于某种原因它说我尝试运行时查询值和目标字段的数量不一样。我很困惑为什么会这样。任何帮助将不胜感激
TotalVerified = " INSERT INTO Totals([TOTAL VERIFIED FORMULARIES], [TOTAL AVAILABLE FOR IMPORT]) " & _
"SELECT COUNT([FORMULARY ID]) " & _
"FROM VerifiedFormularies " & _
"AND COUNT([FORMULARY ID])" & _
"FROM ImportMetricsIDs"
答案 0 :(得分:0)
我认为您想要的查询是:
INSERT INTO Totals([TOTAL VERIFIED FORMULARIES], [TOTAL AVAILABLE FOR IMPORT])
SELECT CNT1, CNT2
FROM (SELECT COUNT([FORMULARY ID]) as CNT1 FROM VerifiedFormularies) as c1 CROSS JOIN
(SELECT COUNT([FORMULARY ID]) as CNT2 FROMImportMetricsIDs) as c2;
AND
是一个布尔运算符,通常用于WHERE
子句,ON
子句或iif()
表达式。它没有连接两个子查询中的值。