join 3 tables if 3rd table does not have that value

Thursday, July 3, 2014

Table 1


id , userid, eventid , name


table 2


eventid , zoneid , userid


table 3


eventid , userid, status


if all three table having the eventid means i dont want to select that record , else i need to select records


i tried my query



$sql="SELECT * FROM `table1` c1 INNER JOIN `table2` c2 ON c2.eventid = c1.eventid LEFT JOIN table3 c3 ON c3.eventid = c1.eventid WHERE c2.zoneid=2 AND c1.active='1' group by c1.eventid ";






http://ift.tt/Vh8zs9