You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'AND ap_flights_loc_county.state_id = ) and ap_flights.prod_test = 'prod' orde...' at line 1