这是我的简化查询:
SELECT `student`.`id`, `student`.`firstname`, `student`.`lastname`,
IFNULL(`review`.`score`, '0') AS `adminreview_score`,
`reviewcolor`.`color` AS adminreview_color FROM (`student`)
LEFT JOIN `review` ON `review`.`student_id` = `student`.`id` AND
review.reviewtype_id = 13
LEFT JOIN `reviewcolor` ON `reviewcolor`.`score` = `adminreview_score`
WHERE `student`.`id` > '0'
这是我得到的错误:
Error Number: 1054
Unknown column 'adminreview_score' in 'on clause'
请注意,表中可能没有review
以下情况:
`review`.`student_id` = `student`.`id` AND review.reviewtype_id = 13
在这种情况下,我想adminreview_score
被设置为0
,我希望reviewcolor.color
beNULL
或 empry ( )
谢谢