optionally sort IDs in subset solution