[英]Syntax error ( missing operator ) in query expression of
I have a table in Access 2010 and I want to make a kind INNER JOIN query from several tables I do is the following: 我在Access 2010中有一个表,我想从几个表中进行一个INNER JOIN查询,我这样做是:
SELECT *
FROM (Archivo Maestro
INNER JOIN Concepto Presupuestal
ON Archivo Maestro.ID Concepto Presupuestal = Concepto Presupuestal.ID Concepto Presupuestal)
INNER JOIN asunto_estrategico
ON Archivo Maestro.ID Asunto Estrategico = asunto_estrategico.ID Asunto Estrategico;
but I get an error saying " Syntax error ( missing operator ) in query expression of 'Archivo Maestro.ID Concepto Presupuestal = Concepto Presupuestal.ID Concepto Presupuesta' and the parenthesis not think they are the problems that are there. 但是我在“ Archivo Maestro.ID Concepto Presupuestal = Concepto Presupuestal.ID Concepto Presupuesta”的查询表达式中收到“说语法错误(缺少运算符)”的错误,并且括号中不认为这是问题所在。
You should avoid having spaces in table names, columns names, or field names. 您应该避免在表名,列名或字段名中留空格。
Try this one: 试试这个:
SELECT * FROM [Archivo Maestro] INNER JOIN [Concepto Presupuestal] ON ([Archivo Maestro].[ID Concepto Presupuestal] = [Concepto Presupuestal].[ID Concepto Presupuestal]) INNER JOIN asunto_estrategico ON ([Archivo Maestro].[ID Asunto Estrategico] = asunto_estrategico.ID); SELECT * FROM [Archivo Maestro]内部联接[Concepto Presupuestal] ON([Archivo Maestro]。[ID Concepto Presupuestal] = [Concepto Presupuestal]。[ID Concepto Presupuestal])内部联接asunto_estrategico ON([Archivo Maestro]。[ID Asunto]。 Estrategico] = asunto_estrategico.ID);
Best advise would be to rename all tables and columns using underscore instead of space: Concepto Presupuestal --> Concepto_Presupuestal. 最好的建议是使用下划线而不是空格来重命名所有表和列:Concepto Presupuestal-> Concepto_Presupuestal。 This will save you lots of problems.
这将为您节省很多问题。
Problem is that your table names include space and so query parser/engine taking it as two different literal names. 问题是您的表名包含空格,因此查询解析器/引擎将其作为两个不同的文字名称。 You should escape them using
[]
. 您应该使用
[]
对其进行转义。 Also, notice that I have used table alias ( am
, cp
, ae
) for ease of reading. 另外,请注意,为了方便阅读,我使用了表别名(
am
, cp
, ae
)。 Your query should look like 您的查询应如下所示
SELECT am.* FROM [Archivo Maestro] am
INNER JOIN [Concepto Presupuestal] cp ON am.ID = cp.ID
INNER JOIN [asunto_estrategico] ae ON am.ID = ae.ID;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.