Actually, King David did not go to the fight of Rabbah because he was committing adultery with Bathsheba, who was Uriah the Hittites wife, actually. And when David got Bathsheba pregnant, David called back Uriah from Rabbah (which Joab was leading/fighting) and gave him the "Heeeeey, you fought so well in Rabbah. Go take a break and fuck yer wife." When Uriah denied King David and stuck by the Israelite code of honor which was something along the lines of 'I don't get laid during war 'cause I gotsa fight.' David sent Uriah back to Joab with a letter instructing Joab to abandon Uriah on the battlefield "that he may be struck down and die." Instead, Joab went up against the walls and told the messenger to tell David that people came out of the fortress of Rabbah, and when they chased them, some servants of his died, as well as Uriah.
"[t]he men of the city went out and fought against Joab, and some of the people among David's servants fell; and Uriah the Hittite also died." (2 Samuel 11:19-21).
In short, you're a little wrong there, Tino.