tags:

views:

140

answers:

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?

+3  A: 

You missed a comma:

NULL,  [4 0 Other]
SLaks
Kudos to SO - the query is more readable here than it is in the Access SQL view.
mdma