Update sql query.