Changing retrieve query to exact query