我正在MS Access中构建此数据库并创建此查询,它在Access中运行正常,但仅当我尝试将数据从Excel链接/源到它时才会提示此错误消息。
SELECT DISTINCT [Combined Risk - Current Mth].DUNS,
[Combined Risk - Current Mth].[Name Supplied],
[Combined Risk - Current Mth].[Combined Risk Rating],
[Combined Risk - Previous Mth].[Combined Risk Rating],
[Combined Risk - 4th Mth].[Combined Risk Rating],
[Combined Risk - 3rd Mth].[Combined Risk Rating],
[Combined Risk - 2nd Mth].[Combined Risk Rating],
[Combined Risk - 1st Mth].[Combined Risk Rating]
FROM (((([Combined Risk - Current Mth]
LEFT JOIN [Combined Risk - 4th Mth] ON [Combined Risk - Current Mth].DUNS = [Combined Risk - 4th Mth].DUNS)
LEFT JOIN [Combined Risk - 3rd Mth] ON [Combined Risk - Current Mth].DUNS = [Combined Risk - 3rd Mth].DUNS)
LEFT JOIN [Combined Risk - 2nd Mth] ON [Combined Risk - Current Mth].DUNS = [Combined Risk - 2nd Mth].DUNS)
LEFT JOIN [Combined Risk - 1st Mth] ON [Combined Risk - Current Mth].DUNS = [Combined Risk - 1st Mth].DUNS)
LEFT JOIN [Combined Risk - Previous Mth] ON [Combined Risk - Current Mth].DUNS = [Combined Risk - Previous Mth].DUNS;
任何帮助都会非常感激。 感谢
答案 0 :(得分:1)
问题是由多个具有相同名称的列引起的。别名这些列以解决问题: -
SELECT DISTINCT [Combined Risk - Current Mth].DUNS,
[Combined Risk - Current Mth].[Name Supplied],
[Combined Risk - Current Mth].[Combined Risk Rating] as CRR_current,
[Combined Risk - Previous Mth].[Combined Risk Rating] as CRR_previous,
[Combined Risk - 4th Mth].[Combined Risk Rating] as CRR_4th,
[Combined Risk - 3rd Mth].[Combined Risk Rating] as CRR_3rd,
[Combined Risk - 2nd Mth].[Combined Risk Rating] as CRR_2nd,
[Combined Risk - 1st Mth].[Combined Risk Rating] as CRR_1st
FROM (((([Combined Risk - Current Mth]
LEFT JOIN [Combined Risk - 4th Mth] ON [Combined Risk - Current Mth].DUNS = [Combined Risk - 4th Mth].DUNS)
LEFT JOIN [Combined Risk - 3rd Mth] ON [Combined Risk - Current Mth].DUNS = [Combined Risk - 3rd Mth].DUNS)
LEFT JOIN [Combined Risk - 2nd Mth] ON [Combined Risk - Current Mth].DUNS = [Combined Risk - 2nd Mth].DUNS)
LEFT JOIN [Combined Risk - 1st Mth] ON [Combined Risk - Current Mth].DUNS = [Combined Risk - 1st Mth].DUNS)
LEFT JOIN [Combined Risk - Previous Mth] ON [Combined Risk - Current Mth].DUNS = [Combined Risk - Previous Mth].DUNS;