'How to fix unknown column when working with joins in SQL
The column does exist in the table, however when I run this query, I get an error of "unknown column". I ran explain & describe
to double-check my table
Error Code: 1054. Unknown column 'HrSystem.reviewCycle.reviewCycleID' in 'on clause'
Code:
SELECT
'Completed' AS 'status',
rc.subDepartmentUUID AS subDepartmentUUID,
r.createdDate AS reviewCreatedDate,
rc.reviewCycleID AS reviewCycleID,
r.reviewID,rts.reviewTypeStatusID,
rh.reviewHistoryID,
rts.reviewTypeStatusDescription
FROM
HrSystem.reviewCycle rc, HrSystem.reviewStatus rs
INNER JOIN
HrSystem.reviewCycleExecution rce ON HrSystem.reviewCycle.reviewCycleID = HrSystem.reviewCycleExecution.reviewCycleID
INNER JOIN
HrSystem.review r ON r.reviewCycleID = rc.reviewCycleID
INNER JOIN
HrSystem.reviewHistory rh ON rh.reviewHistoryID = rs.reviewHistoryID
INNER JOIN
HrSystem.reviewTypeStatus rts ON rts.reviewTypeStatusID = rs.reviewTypeStatusID
WHERE
rc.isDisabled = 0
AND rts.reviewTypeStatusID = 8;
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|