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 s.status = 1' at line 5SELECT s.*
FROM site_states_in_tour sit
LEFT JOIN site_states s ON s.id = sit.state_id
WHERE sit.tour_id =
AND s.status = 1