2 Samuel 12:26 Meanwhile Joab fought against Rabbah of the Ammonites and captured the royal citadel. 27 Joab then sent messengers to David, saying, “I have fought against Rabbah and taken its water supply. 28 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.”

29 So David mustered the entire army and went to Rabbah, and attacked and captured it. 30 David took the crown from their king’s[d] head, and it was placed on his own head. It weighed a talent[e] of gold, and it was set with precious stones. David took a great quantity of plunder from the city 31 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.[f] David did this to all the Ammonite towns. Then he and his entire army returned to Jerusalem.



d. 2 Samuel 12:30 Or from Milkom’s (that is, Molek’s)
e. 2 Samuel 12:30 That is, about 75 pounds or about 34 kilograms
f. 2 Samuel 12:31 The meaning of the Hebrew for this clause is uncertain.

This is from blueletterbible.org.

Joab fought against Rabbah and the people of Ammon, and took the royal city: This continued the war that began in 2 Samuel 10. Joab was about to complete the defeat of the Ammonites.

Lest I take the city and it be called after my name: Joab goaded David into returning to battle by saying, “I’ll take all the credit to myself if you don’t come and finish this war.”

David gathered all the people together and went to Rabbah: This was the final phase of David’s restoration. He went back to doing what he should have done all along – leading Israel out to battle, instead of remaining in Jerusalem.

Good, David is back doing what he should have been doing all along. Now he won't be so bored. Now he can avoid the pitfalls that would make him the lead of a movie plot about deception and murder.