【问题标题】:How can I use the table name in a column alias in Access SQL?如何在 Access SQL 的列别名中使用表名?
【发布时间】:2010-08-30 14:14:04
【问题描述】:

在 MS Access 中,我的表是:Exam{id,name},我的查询是

select Exam.id as 'Exam.id',Exam.name as 'Exam.name' from Exam

现在当我执行这个查询时,出现了这个错误:

“Exam.id”不是有效名称。确保它不包含无效字符或标点符号,并且不要太长。

我想使用全表+列作为别名,Exam.name 为'Exam.name',但是如何让Access 接受呢?

【问题讨论】:

    标签: sql ms-access


    【解决方案1】:

    如错误所示,MS Access 中的别名中不允许使用标点符号。考虑修改查询以消除标点符号。

    select e.id as 'ExamId', 
        e.name as 'ExamName' 
    from Exam e
    

    【讨论】:

    • 它解决了。这是因为 dot.i 从它的别名中删除了 dot:Exam.id as 'Exam/id'
    • 是否有数据库可以让您的首选别名 Exam.ID 实际工作?
    • @David:它适用于 Oracle 10g。 select id as "Exam.Id" from MySchema.Exam.
    猜你喜欢
    • 2012-07-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-31
    • 2019-01-22
    • 2010-09-16
    相关资源
    最近更新 更多