final update query