When the sons of Ammon saw that they had made themselves odious to David, Hanun and the sons of Ammon sent 1,000 talents of silver to hire for themselves chariots and horsemen from Mesopotamia, from Aram-maacah and from Zobah. So they hired for themselves 32,000 chariots, and the king of Maacah and his people, who came and camped before Medeba. And the sons of Ammon gathered together from their cities and came to battle. When David heard of it, he sent Joab and all the army, the mighty men. The sons of Ammon came out and drew up in battle array at the entrance of the city, and the kings who had come were by themselves in the field.
Now when Joab saw that the battle was set against him in front and in the rear, he selected from all the choice men of Israel and they arrayed themselves against the Arameans. But the remainder of the people he placed in the hand of Abshai his brother; and they arrayed themselves against the sons of Ammon. He said, “If the Arameans are too strong for me, then you shall help me; but if the sons of Ammon are too strong for you, then I will help you. Be strong, and let us show ourselves courageous for the sake of 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 to the battle against the Arameans, and they fled before him. When the sons of Ammon saw that the Arameans fled, they also fled before Abshai his brother and entered the city. Then Joab came to Jerusalem.
When the Arameans saw that they had been defeated by Israel, they sent messengers and brought out the Arameans who were beyond the River, with Shophach the commander of the army of Hadadezer leading them. When it was told David, he gathered all Israel together and crossed the Jordan, and came upon them and drew up in formation against them. And when David drew up in battle array against the Arameans, they fought against him. The Arameans fled before Israel, and David killed of the Arameans 7,000 charioteers and 40,000 foot soldiers, and put to death Shophach the commander of the army. So when the servants of Hadadezer saw that they were defeated by Israel, they made peace with David and served him. Thus the Arameans were not willing to help the sons of Ammon anymore.