Meanwhile Joab fought against Rabbah of the Ammonites and captured the royal citadel.
References for 2 Samuel 12:26
Joab then sent messengers to David, saying, “I have fought against Rabbah and taken its water supply.
Now muster the rest of the troops and besiege the city and capture it. Otherwise I will take the city, and it will be named after me.”
So David mustered the entire army and went to Rabbah, and attacked and captured it.
David took the crown from their king’s head, and it was placed on his own head. It weighed a talent of gold, and it was set with precious stones. David took a great quantity of plunder from the city
References for 2 Samuel 12:30
and brought out the people who were there, consigning them to labor with saws and with iron picks and axes, and he made them work at brickmaking. David did this to all the Ammonite towns. Then he and his entire army returned to Jerusalem.
References for 2 Samuel 12:31