You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') AND (races_tb.drv_id = driver_tb.drv_id) AND (track_tb.trk_id = sked_tb.trk_' at line 1