The below SQL works in one of my queries. I am mainly referring to the Where Clause:
When I put the same SQL in another query it does not work. I get the following error:
"The LEVEL clause includes a reserved word or argument that is misspelled or missing, or the punctuation is incorrect"
Code:
SELECT WorkUnitsFaultsMainTBL.WorkUnit, WorkUnitsFaultsMainTBL.SystemGroup, WorkUnitsFaultsMainTBL.FaultCategory, WorkUnitsFaultsMainTBL.TodaysDate
FROM WorkUnitsFaultsMainTBL
WHERE (((WorkUnitsFaultsMainTBL.FaultCategory)<>"No Faults" And (WorkUnitsFaultsMainTBL.FaultCategory)<>"Cosmetic") AND ((WorkUnitsFaultsMainTBL.TodaysDate) Between [Start Date] And [End Date]));
When I put the same SQL in another query it does not work. I get the following error:
"The LEVEL clause includes a reserved word or argument that is misspelled or missing, or the punctuation is incorrect"
Code:
Select SystemGroup, Count(*) As [SystemGroups]
From WorkUnitsFaultsMainTBL
WHERE (((WorkUnitsFaultsMainTBL.FaultCategory)<>"No Faults" And (WorkUnitsFaultsMainTBL.FaultCategory)<>"Cosmetic") AND ((WorkUnitsFaultsMainTBL.TodaysDate) Between [Start Date] And [End Date]));
Group By SystemGroup
Can anyone help me to see what I am doing wrong? Thanks in advance.
UNION ALL Select 'Total Work Units', Count(*)
From WorkUnitsFaultsMainTBL
Where [TodaysDate] Between [Start Date] And [End Date];