Error checking hole averages: SELECT round(avg(score),2) as avgscore FROM sm_scoredata s, sm_rounds r, sm_holedata h WHERE r.id=s.roundid and (( r.compid=7927 OR r.compid=7928 r.compid = 7398 or r.compid = 7399 or r.compid = 7401 or r.compid = 7402 or r.compid = 7404 or r.compid = 7405)) and r.courseid=h.courseid and h.par=3 and h.hole=s.hole and s.score > 0You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'r.compid = 7398 or r.compid = 7399 or r.compid = 7401 or r.compid = 7402 or r.co' at line 3