如何在Access SQL的列别名中使用表名? [英] How can I use the table name in a column alias in Access SQL?

查看:197
本文介绍了如何在Access SQL的列别名中使用表名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

In MS Access, my table is:Exam{id,name}, and my query is

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

现在,当我执行此查询时,会发生此错误:

Now when I executed this query this error ocurred:

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

"Exam.id" is not a valid name. Make sure that it does not include invalid characters or punctuation and that it is not too long.

我想使用完整的表+列作为别名,将Exam.name用作"Exam.name",但是如何获得Access接受呢?

I want to use the full table + column as the alias, Exam.name as 'Exam.name', but how can I get Access to accept it?

推荐答案

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

As the error indicates, punctuation is not allowed in an alias in MS Access. Consider revising your query to eliminate punctuation.

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

这篇关于如何在Access SQL的列别名中使用表名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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