James Preus James Preus - 1 year ago 49
SQL Question

How To Use WHERE clause with LEFT JOIN

Here is my query:

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

Can someone please help me figure out why this wont run?


Change your where clause to properly quote the right hand side value.

WHERE 2016step2a1.whichCamp = 'CampIAM'