1 Chronicles 19
David Defeats the Ammonites 1
Some time after this, King Nahash of the Ammonites died, and his son Hanun 
David said, "I am going to show loyalty to Hanun because his father, Nahash, was always loyal to me." So David sent messengers to express sympathy to Hanun about his father's death.
But when David's ambassadors arrived in the land of Ammon,
the Ammonite commanders said to Hanun, "Do you really think these men are coming here to honor your father? No! David has sent them to spy out the land so they can come in and conquer it!"
So Hanun seized David's ambassadors and shaved them, cut off their robes at the buttocks, and sent them back to David in shame.
When David heard what had happened to the men, he sent messengers to tell them, "Stay at Jericho until your beards grow out, and then come back." For they felt deep shame because of their appearance.
When the people of Ammon realized how seriously they had angered David, Hanun and the Ammonites sent 75,000 pounds 
of silver to hire chariots and charioteers from Aram-naharaim, Aram-maacah, and Zobah.
They also hired 32,000 chariots and secured the support of the king of Maacah and his army. These forces camped at Medeba, where they were joined by the Ammonite troops that Hanun had recruited from his own towns.
When David heard about this, he sent Joab and all his warriors to fight them.
The Ammonite troops came out and drew up their battle lines at the entrance of the city, while the other kings positioned themselves to fight in the open fields.
When Joab saw that he would have to fight on both the front and the rear, he chose some of Israel's elite troops and placed them under his personal command to fight the Arameans in the fields.
He left the rest of the army under the command of his brother Abishai, who was to attack the Ammonites.
"If the Arameans are too strong for me, then come over and help me," Joab told his brother. "And if the Ammonites are too strong for you, I will help you.
Be courageous! Let us fight bravely for our people and the cities of our God. May the LORD's will be done."
When Joab and his troops attacked, the Arameans began to run away.
And when the Ammonites saw the Arameans running, they also ran from Abishai and retreated into the city. Then Joab returned to Jerusalem.
The Arameans now realized that they were no match for Israel, so they sent messengers and summoned additional Aramean troops from the other side of the Euphrates River. 
These troops were under the command of Shobach, 
the commander of Hadadezer's forces.
When David heard what was happening, he mobilized all Israel, crossed the Jordan River, and positioned his troops in battle formation. Then David engaged the Arameans in battle, and they fought against him.
But again the Arameans fled from the Israelites. This time David's forces killed 7,000 charioteers and 40,000 foot soldiers, including Shobach, the commander of their army.
When Hadadezer's allies saw that they had been defeated by Israel, they surrendered to David and became his subjects. After that, the Arameans were no longer willing to help the Ammonites.