我收到错误"未知列' YahrzeitName'在' on条款'"尝试运行以下查询时:
SELECT
concat(yahrzeit.firstName, ' ', yahrzeit.middleName, ' ', yahrzeit.lastName)
AS 'YahrzeitName',
concat(yahrzeit.gregorianYear, '-', yahrzeit.gregorianMonthNum, '-', yahrzeit.gregorianDay)
AS Date,
tbldecedent.Name
FROM yahrzeit INNER JOIN tbldecedent
ON YahrzeitName = tbldecedent.Name
答案 0 :(得分:1)
您无法在join
语句中使用列别名,请使用完整表达式替换别名:
SELECT
concat(yahrzeit.firstName, ' ', yahrzeit.middleName, ' ', yahrzeit.lastName) AS `YahrzeitName`,
concat(yahrzeit.gregorianYear, '-', yahrzeit.gregorianMonthNum, '-', yahrzeit.gregorianDay) AS `Date`,
tbldecedent.Name
FROM yahrzeit
INNER JOIN tbldecedent
ON concat(yahrzeit.firstName, ' ', yahrzeit.middleName, ' ', yahrzeit.lastName) = tbldecedent.Name