1 Chronicles 19
David is kind to Ammonites, Ammonites humiliate messengers
After this, the Ammonites' King Nahash died and his son reigned in his place. David said, "I will be kind to Nahash's son Hanun because his father was kind to me." So David sent messengers to console him about his father. When they got there, the Ammonite princes asked Hanun, "Do you really think David is honoring your father by sending these guys? I bet they came as spies looking to overthrow our land." So Hanun took David's servants, shaved their heads, cut their clothes at the hips, and sent them away. When David heard what had happened, he sent messengers to meet them since they were so ashamed. The king told them, "Stay at Jericho until your beards have grown back, and then you can come home."
Ammonites hire Syrian troops
When the Ammonites realized that they annoyed David, they spent 75,000 pounds of silver to hire chariots and horsemen from Aram-maacah and Zobah in Mesopotamia. They hired 32,000 chariots and Maacah's army came with their king and set up camp outside of Medeba. The Ammonites were drafted from their cities and prepared for battle. When David heard this, he sent Joab and his entire army of mighty warriors. The Ammonites came out of the city prepared for battle along with their kings.
Israel advances, Ammonites & Syrians retreat
When Joab saw that he was surrounded, he chose some of his best men and stationed them against the Syrians. He assigned the rest of the men under his brother Abishai, and stationed them against the Ammonites. He told them, "If the Syrians are too strong for me, then you can help me, and if the Ammonites are too strong for you, then I can help you. Be strong! Let's use our strength for the people and cities of our God, and may the Existing One do whatever seems good to him." So Joab and his people approached the Syrians for battle, and caused them to retreat. When the Ammonites saw that the Syrians were running away, they also ran from Abishai, retreating into the city. Then Joab came back to Jerusalem.
David defeats Syria
When the Syrians realized that Israel had defeated them, they sent messengers across the Euphrates who brought back more Syrians along with commander Shophach and their leader Hadadezer. When David heard this, he gathered all of Israel together, crossed the Jordan, and opposed them with all of Israel's forces. Israel and Syria fought there, and David killed 7,000 chariot drivers, 40,000 foot soldiers, and commander Shophach, causing the Syrians to run away. When Hadadezer's servants saw that Israel defeated them, they made peace with David and became his subordinates. So the Syrians weren't willing to fight for the ammonites anymore after that.