我想在Excel中使用来自SQL Server的数据上传我的列表框。
我在服务器上运行此查询并且工作正常。
我试图在谷歌搜索帮助但失败了。
我认为我的查询语法有问题。
s = "SELECT DISTINCT(B.[Manager Name]), A.[SESA ID] " & _
"FROM [Current Job Data] AS A" & _
"LEFT JOIN [Work Relationship Report] AS B " & _
"ON B.[Manager Person Number]= A.[Employee Person Number] " & _
"INNER JOIN [Work Relationship Report] AS C ON B.[Manager Name] = C.[Manager Name]" & _
"WHERE b.[Manager Name] Is Not Null"
当我运行查询时,我收到错误消息:
多部分标识符" A.Employee Person Number"不可能 界。
我不知道如何解决这个问题,谢谢你的帮助:)。
答案 0 :(得分:1)
添加尾随空格。您的整个字符串是一行字符串。
FROM [Current Job Data] AS A" & _ "LEFT Join..."
变为
FROM [Current Job Data] AS ALEFT Join ...
因此没有标识符A