"Pyrrhic victory."
A Pyrrhic victory is a victory that inflicts such a devastating toll on the victor that it is tantamount to defeat. Such a victory negates any true sense of achievement or damages long-term progress.
The phrase originates from a quote from Pyrrhus of Epirus, whose triumph against the Romans in the Battle of Asculum in 279 BC destroyed much of his forces, forcing the end of his campaign.
https://en.wikipedia.org/wiki/Pyrrhic_victory