I Chronicles 19:1-19 NKJV
It happened after this that Nahash the king of the people of Ammon died, and his son reigned in his place. Then David said, “I will show kindness to Hanun the son of Nahash, because his father showed kindness to me.” So David sent messengers to comfort him concerning his father. And David’s servants came to Hanun in the land of the people of Ammon to comfort him.
And the princes of the people of Ammon said to Hanun, “Do you think that David really honors your father because he has sent comforters to you? Did his servants not come to you to search and to overthrow and to spy out the land?”
Therefore Hanun took David’s servants, shaved them, and cut off their garments in the middle, at their buttocks, and sent them away. Then some went and told David about the men; and he sent to meet them, because the men were greatly ashamed. And the king said, “Wait at Jericho until your beards have grown, and then return.”
When the people of Ammon saw that they had made themselves repulsive to David, Hanun and the people of Ammon sent a thousand talents of silver to hire for themselves chariots and horsemen from Mesopotamia, from Syrian Maacah, and from Zobah. So they hired for themselves thirty-two thousand chariots, with the king of Maacah and his people, who came and encamped before Medeba. Also the people of Ammon gathered together from their cities, and came to battle.
Now when David heard of it, he sent Joab and all the army of the mighty men. Then the people of Ammon came out and put themselves in battle array before the gate of the city, and the kings who had come were by themselves in the field.
When Joab saw that the battle line was against him before and behind, he chose some of Israel’s best and put them in battle array against the Syrians. And the rest of the people he put under the command of Abishai his brother, and they set themselves in battle array against the people of Ammon. Then he said, “If the Syrians are too strong for me, then you shall help me; but if the people of Ammon are too strong for you, then I will help you. Be of good courage, and let us be strong for our people and for the cities of our God. And may the LORD do what is good in His sight.”
So Joab and the people who were with him drew near for the battle against the Syrians, and they fled before him. When the people of Ammon saw that the Syrians were fleeing, they also fled before Abishai his brother, and entered the city. So Joab went to Jerusalem.
Now when the Syrians saw that they had been defeated by Israel, they sent messengers and brought the Syrians who were beyond the River, and Shophach the commander of Hadadezer’s army went before them. When it was told David, he gathered all Israel, crossed over the Jordan and came upon them, and set up in battle array against them. So when David had set up in battle array against the Syrians, they fought with him. Then the Syrians fled before Israel; and David killed seven thousand charioteers and forty thousand foot soldiers of the Syrians, and killed Shophach the commander of the army. And when the servants of Hadadezer saw that they were defeated by Israel, they made peace with David and became his servants. So the Syrians were not willing to help the people of Ammon anymore.
NKJV: New King James Version