Joab fought against Rabbah of the Ammonites and captured the royal fortress.
References for 2 Samuel 12:26
Then Joab sent messengers to David to say, "I have fought against Rabbah and have also captured the water supply.
Now therefore, assemble the rest of the troops, lay siege to the city, and capture it. Otherwise I will be the one to capture the city, and it will be named after me.
So David assembled all the troops and went to Rabbah; he fought against it and captured it.
He took the crown from the head of their king, and it was [placed] on David's head. The crown weighed 75 pounds of gold, and it had a precious stone [in it]. In addition, David took away a large quantity of plunder from the city.
References for 2 Samuel 12:30
He removed the people who were in the city and put [them to work] with saws, iron picks, and iron axes, and to labor at brickmaking. He did the same to all the Ammonite cities. Then he and all his troops returned to Jerusalem.
References for 2 Samuel 12:31