When the king of the Ammonites dies, David sends a group to offer their condolences to his son, Hanun. After all, the late king was always nice to David, so he's fine with continuing to honor the peace between them.
But Hanun's advisors convince him that David's men are in town as spies. So Hanun has them shaved and publicly humiliated.
David's ticked that his goodwill has been rebuffed and Hanun is sensing trouble. He aligns with some neighboring countries to pool military resources in the hopes that they can destroy David together.
But David sends his main man Joab along with his army to fight them off.
Joab and his brother manage to scare off both the Ammonites and their co-conspirators, the Arameans. They go running and Joab heads back to Jerusalem. All in a day's work.
But the Arameans decide to come back for more. This time, they go up against David himself and he manages to kill 47,000 of them with his army.
Needless to say, the Arameans declare they're not going to rush to help the Ammonites ever again. First smart thing they've done all war.