与加入 MS Access 数据库相关的问题 [英] Issue Related to Join in MS Access Database

查看:34
本文介绍了与加入 MS Access 数据库相关的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 MS Access 数据库中使用以下查询:

I am using the following query in an MS Access database:

SELECT SD.RollNo, SD.Name , ED.ExamName, (
    SELECT count(*) 
    FROM (
        SELECT DISTINCT innerED.StudentId 
        FROM ExamDetails innerED 
        WHERE innerED.StudentId=SD.StudentId 
    )
) AS StudentId
FROM StudentDetails SD 
LEFT OUTER JOIN ExamDetails ED 
    ON SD.StudentId= ED.StudentId

每当我执行此查询时,都会出现一个对话框并询问参数 SD.StudentId 的值.它为什么要这样做,我该如何阻止它这样做?

Whenever I execute this query, a dialog box comes up and asks for the value of the parameter SD.StudentId. Why is it asking for this, and how do I stop it from doing so?

推荐答案

MS Access 不理解计数 (*) 聚合上的 SELECT 语句.访问 SQL 语句如下所示.

MS Access does not understand the SELECT statement on the Count (*) Aggregate. To Access the SQL Statement looks like this.

 SELECT DISTINCT innerED.StudentId
 FROM ExamDetails innerED 
 WHERE innerED.StudentId=SD.StudentId 

因为别名 AS STUDENTID 出现在语句的结尾之后,这个 Select 语句不能识别它,所以它不知道 .StudendID 是什么,所以它假设它是一个参数.

Because the alias AS STUDENTID comes after the end of the statement, this Select statement doesn't recognize it, so it has no idea what .StudendID is so it assumes it's a parameter.

MS Access,当遇到查询本身未识别的参数时,会提示用户输入一个值.

MS Access, when faced with a parameter that has not been identified in the query itself will prompt the user for a value.

重写查询,以便此 Select 语句可以识别所有表源.

Rewrite the query so that this Select statement can identify all the table sources.

这篇关于与加入 MS Access 数据库相关的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆