I recently heard the following halacha from a talmid Chacham. He said "I remember that this is the halacha, but I do not remember the source".
If one has to do a melacha on shabbos for a choleh sheyesh bo sakanah (a sick person in danger of dying), and he has 2 options. One will also benefit a healthy person, and the other will benefit only the sick person. He should choose the option which will benefit only the sick person and not the healthy person. He added that this is even where there is no concern of שמא ירבה בשבילו - that he may add additional melacha for the healthy person.
He gave two examples:
1) A sick person needs food. The food can be taken from any of 2 refrigerators. Opening either refrigerator will cause its light to go on. One of the two refrigerators also contains food which can be then available to healthy people. The other refrigerator contains only the food needed for the sick person. One should (I'm not sure if its mandatory or preferable) open the refrigerator which contains only the sick person's food rather than open the refrigerator which contains the healthy people's food also.
2) A sick person needs to be taken by ambulance to a hospital in another city on Shabbos. Two people (Hatzalah members) offer to drive the ambulance. One of the two has a relative in the other city who is having a family Bar Mitzvah celebration on that Shabbos. He wants to drive there and take part in the family celebration. The other is driving solely for the purpose of transporting the patient. The ambulance should be driven by the one who has no benefit other than transporting the patient, rather than by the person who will have his own benefit from making the trip.
Does anyone here know of a source for this?