I have a query in SQL Server that I am trying to convert to a query in MS-Access 2003. The query is designed to be used as the basis for a report. The report has two fields .. 'Cases Assigned' and 'Cases Closed'.
SELECT
(SELECT COUNT(*)
FROM CaseDetail
WHERE CaseAssignedDate Between '1/1/2008' AND '1/1/2009') as 'Cases Assigned',
(SELECT COUNT(*)
FROM CaseDetail
WHERE CaseClosedDate BETWEEN '1/1/2008' AND '1/1/2009') as 'Cases Closed'
I am having difficulty using the SQL in Access 2003. I have replaced the '
characters with #
for Access's sake but still no joy. Does Access have a problem with SELECT within SELECT statements? The error I get from Access is less than helpful.
Reserved error (-3205); there is no message for this error
Also, what if the SQL statement was such that data needed to be obtained from more than one table. For example ...
SELECT
(SELECT COUNT(*)
FROM AssignedCases
WHERE CaseAssignedDate Between '1/1/2008' AND '1/1/2009') as 'Cases Assigned',
(SELECT COUNT(*)
FROM ClosedCases
WHERE CaseClosedDate BETWEEN '1/1/2008' AND '1/1/2009') as 'Cases Closed'
This works in SQL without issue, but not in Access.