以下是我的代码示例。当我尝试切换到设计视图时,它给了我一个错误:
" Microsoft Access无法在设计视图"中表示连接表达式a.Course_name = b.Course_name。
当我在stackoverflow上搜索此错误时,我发现了一个帖子。根据帖子,解决方案在此链接中给出(http://support.microsoft.com/kb/207868)。根据此链接,try to remove extra parenthesis (especially nested parenthesis) and problem will be resolved
。但是,在我的查询中,我没有嵌套的括号。所以我不知道如何解决它。任何帮助,将不胜感激。
SELECT a.Course_name, COUNT(b.Student_code) AS [Total], Format(b.Retrieved_date,"mmmm yyyy") AS [Month]
FROM Course AS a LEFT JOIN (SELECT b.Course_name, b.Student_code, b.Retrieved_date FROM pending-enrolment AS b WHERE b.Retrieved_date BETWEEN [Forms]![ParameterForm]![txtBeginDate] AND [Forms]![ParameterForm]![txtEndDate]) b
ON a.Course_name=b.Course_name
GROUP BY a.Course_name, b.Retrieved_date
;
答案 0 :(得分:0)
尝试以下代码(经过测试并 100% 有效):
SELECT Course.Course_name, Count(b.Student_code) AS CountOfStudent_code,
Format([b].[Retrieved_date],"mmmm yyyy") AS [Month]
FROM Course
LEFT JOIN
(
SELECT [pending-enrolment].Course_name, [pending-enrolment].Student_code,
[pending-enrolment].Retrieved_date
FROM [pending-enrolment]
WHERE ([pending-enrolment].Retrieved_date
Between [Forms]![ParameterForm]![txtBeginDate]
And [Forms]![ParameterForm]![txtEndDate])
) AS b ON Course.Course_name = b.Course_name
GROUP BY Course.Course_name, Format([b].[Retrieved_date],"mmmm yyyy");