1 Chronicles 19:8-19

ISV(i) 8 In response, David sent out Joab and his entire army of elite soldiers. 9 The Ammonites went out in battle formation in front of the entrance to the city while the kings who had come stayed by themselves in the open fields.
10 When Joab observed that the battle lines were set up to oppose him both in front and behind, he appointed some special forces from Israel and arrayed them to oppose the Arameans, 11 putting the rest of his forces under command of his brother Abishai, who arrayed them to oppose the Ammonites. 12 He told Abishai, “If the Arameans prove too strong for me, then you are to help me. If the Ammonites prove too strong for you, then I will help you. 13 Be strong, be courageous on behalf of our people and for the cities of our God, and may the LORD do what he thinks is best.” 14 So Joab and the soldiers who were with him attacked the Arameans in battle formation, and the Arameans retreated in front of him. 15 When the Ammonites saw the Arameans retreating, they also retreated from Joab’s brother Abishai back to the city and Joab left for Jerusalem. 16 After the Arameans realized that they had been defeated by Israel, they sent for the Arameans who lived beyond the Euphrates River. Shophach was leading them as commander of Hadadezer’s army.
17 When David learned this, he mustered all of Israel, crossed the Jordan, approached the Arameans, and drew up his forces against them. After David had assembled in battle array against the Arameans, the Arameans attacked him. 18 The Arameans retreated from Israel, and David’s forces killed 7,000 Aramean charioteers, 40,000 soldiers, and Shophach, the commander of their army. 19 When Hadadezer’s officials saw that they had been defeated by Israel, they sought terms of peace with David and became subservient to him. After this, the Arameans were unwilling to help the Ammonites anymore.