I want to upload my list box in Excel with data from SQL server.
I'm running this query on server and is working fine.
I tried to search for help on google but failed.
I have an problem with my query syntax I assume.
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"
When I run my query I'm getting an error message:
The multi-part identifier "A.Employee Person Number" could not be bound.
I don't know how to fix this, thank you for your help :)
SELECT DISTINCT, and applies to the whole selected rows. Remove those redundant parentheses and simply writeSELECT DISTINCT B.[Manager Name]) + ...to make things clearer.