先生,我有问题,我有这个问题
"SELECT alumni.`ID NO`, alumni.`LAST NAME`, alumni.`GIVEN NAME_MI`,
alumni.`COURSE`, courses.`CollegeID`, office365alumni.`EmailAddress`,
office365alumni.`ContactNumber`
FROM alumni
LEFT JOIN courses ON alumni.`COURSE` = courses.`ID`
LEFT JOIN office365alumni ON alumni.`ID NO` = office365alumni.`IDNumber`
WHERE alumni.`ID NO` = @IDNumber"
它给了我错误
syntax error (missing operator) in query expression
'alumni.`COURSE` = courses.`ID` LEFT JOIN office365alumni
ON alumni.`ID NO` = office365alumni.`IDNumber'.
我的查询有什么问题?感谢
答案 0 :(得分:0)
您的列名称中包含空格。将列名包装在方括号中,然后看看如何:
SELECT
alumni.[ID NO],
alumni.[LAST NAME],
alumni.[GIVEN NAME_MI],
alumni.[COURSE],
courses.[CollegeID],
office365alumni.[EmailAddress],
office365alumni.[ContactNumber]
FROM
(alumni
LEFT JOIN courses ON alumni.[COURSE] = courses.[ID])
LEFT JOIN office365alumni ON alumni.[ID NO] = office365alumni.[IDNumber]
WHERE alumni.[ID NO] = @IDNumber