如何在LEFT JOIN中使用WHERE子句

时间:2016-05-25 20:49:35

标签: mysql sql

这是我的问题:

SELECT 2016step2a1.id_step2a1, 2016step2a1.camperLast, 2016step2a1.camperFirst, 
        2016step2a1.camperGender, 2016step2a1.camperAge, 2016step2a1.guardName, 
        2016step2a1.guardCellphone, 2016step2a1.camperAddress, 2016step2a1.camperApartment, 
        2016step2a1.camperCity, 2016step2a1.camperState, 2016step2a1.camperZip, 
        2016step2a1.guardEmail, 2016step2a1.camperDiag, 2016step2a6.shirtT
FROM 2016step2a1
LEFT JOIN 2016step2a6 ON 2016step2a1.user_id = 2016step2a6.user_id
LEFT JOIN 2016step2a4 ON 2016step2a1.user_id = 2016step2a4.user_id
LEFT JOIN 2016step2a5 ON 2016step2a1.user_id = 2016step2a5.user_id
WHERE 2016step2a1.whichCamp = CampIAM

有人可以帮我弄清楚为什么不运行?

1 个答案:

答案 0 :(得分:2)

更改您的where子句以正确引用右侧值。

WHERE 2016step2a1.whichCamp = 'CampIAM'

相关问题