Throw out the baby with the bath water

Throw out the baby with the bath water is an idiom.
The phrase describes a special kind of mistake which happens when something good is lost while trying to get rid of something bad.
The idiom summarizes what happens when something which is necessary is rejected along with what is not necessary.
A slightly different explanation focuses on the loss of the essential while holding on to what is not essential. In other words, the idiom also makes sense when someone might throw out the baby and keep the bath water. Idioms are a common stumbling block for learners of a language.
History.
This idiom comes from a German proverb, "das Kind mit dem Bade ausschütten." In 1512, "Narrenbeschwörung" ("Appeal to Fools") by Thomas Murner includes a woodcut picture showing a woman tossing a baby out with waste water.
Alternate expressions.
The meaning and intent are sometimes mirrored in different terms.