update query and record fetching