1

i have this sql statement in access:

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];

everything was fine until i added the last line:

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

i get this error:

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

anyone have any clues why i am getting this error?

1
  • You really ought to use more rational field names. Commented May 14, 2010 at 3:00

1 Answer 1

3

You missed a comma:

NULL,  [4 0 Other]
Sign up to request clarification or add additional context in comments.

1 Comment

Kudos to SO - the query is more readable here than it is in the Access SQL view.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.