简体   繁体   中英

Left join unknown column

I am getting Unknown column 'assessment_assessment_type_lookup.assessment_type_fk' in 'on clause' with the query below. The tables and columns are correct.

SELECT * FROM assessment
LEFT JOIN assessment_type 
ON assessment_type.assessment_type_pk = assessment_assessment_type_lookup.assessment_type_fk
LEFT JOIN assessment as ass
ON ass.assessment_pk = assessment_assessment_type_lookup.assessment_fk
LEFT JOIN unit_outcome
ON unit_outcome.unit_outcome_pk = unit_unit_outcome_lookup.unit_outcome_fk
LEFT JOIN unit
ON unit.unit_pk = unit_unit_outcome_lookup.unit_fk
LEFT JOIN unit_outcome as uo
ON uo.unit_outcome_pk = unit_outcome_assessment_lookup.unit_outcome_fk
LEFT JOIN assessment as ass2
ON ass2.assessment_pk = unit_outcome_assessment_lookup.assessment_fk
AND unit.unit_pk = '$unit_pk' GROUP BY assessment.assessment_pk

You are trying to join assessment and assessment_type via table assessment_assessment_type_lookup which can not be done.

If you wish to join 2 tables, you must use both of them in their ON clause.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM