houstonbill
Technical User
- Nov 6, 2006
- 92
I have looked at multiple examples and postings and I still cannot get my Union Query to work. Below is what I have at the current time. Can someone please take a look at it and tell me what I am missing, or perhaps where I went wrong? When I run the query, I get the following error: "Syntax error in Union Query".
SELECT IIf(Weekday(Date())=2,Date()-3,Date()-1) AS [Date], Count(tblOpenCases.[Desk Cd]) AS Profess
FROM tblOpenCases
WHERE (((tblOpenCases.[Resp Cd]) Like "*1*" Or (tblOpenCases.[Resp Cd]) Like "*3*" Or (tblOpenCases.[Resp Cd]) Like "*5*" Or (tblOpenCases.[Resp Cd]) Like "*7*" Or (tblOpenCases.[Resp Cd]) Like "*9*"))
GROUP BY IIf(Weekday(Date())=2,Date()-3,Date()-1)
HAVING (((tblOpenCases.[Desk Cd])="00"))
UNION SELECT IIf(Weekday(Date())=2,Date()-3,Date()-1) AS [Date], Count(tblOpenCases.[Desk Cd]) AS Facility
FROM tblOpenCases
WHERE (((tblOpenCases.[Res Cd]) Like "*0*" Or (tblOpenCases.[Resp Cd]) Like "*2*" Or (tblOpenCases.[Resp Cd]) Like "*4*" Or (tblOpenCases.[Resp Cd]) Like "*6*" Or (tblOpenCases.[Resp Cd]) Like "*8*"))
GROUP BY IIf(Weekday(Date())=2,Date()-3,Date()-1)
HAVING (((tblOpenCases.[Desk Cd])="00");
SELECT IIf(Weekday(Date())=2,Date()-3,Date()-1) AS [Date], Count(tblOpenCases.[Desk Cd]) AS Profess
FROM tblOpenCases
WHERE (((tblOpenCases.[Resp Cd]) Like "*1*" Or (tblOpenCases.[Resp Cd]) Like "*3*" Or (tblOpenCases.[Resp Cd]) Like "*5*" Or (tblOpenCases.[Resp Cd]) Like "*7*" Or (tblOpenCases.[Resp Cd]) Like "*9*"))
GROUP BY IIf(Weekday(Date())=2,Date()-3,Date()-1)
HAVING (((tblOpenCases.[Desk Cd])="00"))
UNION SELECT IIf(Weekday(Date())=2,Date()-3,Date()-1) AS [Date], Count(tblOpenCases.[Desk Cd]) AS Facility
FROM tblOpenCases
WHERE (((tblOpenCases.[Res Cd]) Like "*0*" Or (tblOpenCases.[Resp Cd]) Like "*2*" Or (tblOpenCases.[Resp Cd]) Like "*4*" Or (tblOpenCases.[Resp Cd]) Like "*6*" Or (tblOpenCases.[Resp Cd]) Like "*8*"))
GROUP BY IIf(Weekday(Date())=2,Date()-3,Date()-1)
HAVING (((tblOpenCases.[Desk Cd])="00");