ms-access:查询表达式中缺少运算符

时间:2010-05-13 00:50:36

标签: sql ms-access vba

我在访问中有这个sql语句:

SELECT *
FROM (SELECT [Occurrence Number], [1 0 Preanalytical (Before Testing)], NULL, NULL,NULL FROM [Lab Occurrence Form] 
WHERE NOT ([1 0 Preanalytical (Before Testing)] IS NULL)
  UNION
  SELECT [Occurrence Number],  NULL, [2 0 Analytical (Testing Phase)], NULL,NULL FROM  [Lab Occurrence Form]  WHERE NOT ([2 0 Analytical (Testing Phase)] IS NULL)
  UNION
  SELECT  [Occurrence Number],  NULL, NULL, [3 0 Postanalytical ( After Testing)],NULL FROM  [Lab Occurrence Form]  WHERE NOT ([3 0 Postanalytical ( After Testing)] IS NULL)
 UNION
  SELECT  [Occurrence Number],  NULL, NULL,NULL  [4 0 Other] FROM  [Lab Occurrence Form]  WHERE NOT ([4 0 Other] IS NULL)
)  AS mySubQuery
ORDER BY mySubQuery.[Occurrence Number];

一切都很好,直到我添加了最后一行:

SELECT  [Occurrence Number],  NULL, NULL,NULL  [4 0 Other] FROM  [Lab Occurrence Form]  WHERE NOT ([4 0 Other] IS NULL)

我收到此错误:

syntax error (missing operator) in query expression 'NULL [4 0 Other]'

任何人都有任何线索我为什么会收到此错误?

1 个答案:

答案 0 :(得分:3)

你错过了一个逗号:

NULL,  [4 0 Other]