maybe `sql_query.upcase.include? "JOIN"` here instead? Just to be on the safe side?