This is the essence of utilitarism, a philosphical school way more common in anglo-saxiion philosphy than in classical philosophy (by wich I mean anything evolving from the ancient greek). Europe aside of Great Britain has resorted to the classical way while anglo-saxion philosiphy follows the utilitarism trail. I think it is of value to be aware of this difference, when discussing ethical problems. One must be able to discuss both points of view. The results are quite different. Christian ethics is based on the ancient greek, so it is classical.
What I confront utilitarism with is the fact, that its basic principle demands among other things the death of innocent people for the greater good. - without their consent or option to chosse wether to help this way or not. Dawkins position on childs with Down syndrome is an example.
But it is a pity to see that parents, when they get to choose wether to abort a pregnancy or not, if the child will suffer from the Down syndrome, they way more often choose to abort. Looking at the life of those people whose parents choosed the other option I find that the parents that abort are efffectively killing someone, denying him to live the life that is there as a future, and that life is enjoyable.
To sacrifice for the greater good must always be a deliberate choice of those poeple giving the sacrifice - that is the classical view. The uteralistic view does not ask for this. People are sacrified without their consent for the well-being of those who live on. Anyone can be this - for the greater good.
Please note that this philosophical statement does not refer to any religion.