David must have been in the habit of working with his military commanders as equals (or as close to equal as a king can be), especially with Joab, Abishai and Ittai (the man from Gath). When he told his troops that he would go out with them to fight the rest of Israel (led by Absalom):
2 Samuel 18:3 His men objected strongly. ‘You must not go,’ they urged. ‘If we have to turn and run—and even if half of us die—it will make no difference to Absalom’s troops; they will be looking only for you. You are worth 10,000 of us, and it is better that you stay here in the town and send help if we need it.’
He accepted their strategy:
2 Samuel 18:4 ‘If you think that’s the best plan, I’ll do it,’ the king answered. So he stood alongside the gate of the town as all the troops marched out in groups of hundreds and of thousands.
It could well have saved his life.
Joab in particular must have been confident of his relationship with David. No one else had the confidence to kill Absalom, the others refusing to “kill the king’s son for even a thousand pieces of silver”, even though it ended the rebellion almost instantly.
Joab, on the other hand, not only killed Absalom, but then chastised David for mourning his death:
2 Samuel 19:5-7 We saved your life today and the lives of your sons, your daughters, and your wives and concubines. Yet you act like this, making us feel ashamed of ourselves. You seem to love those who hate you and hate those who love you. You have made it clear today that your commanders and troops mean nothing to you. It seems that if Absalom had lived and all of us had died, you would be pleased. Now go out there and congratulate your troops, for I swear by the Lord that if you don’t go out, not a single one of them will remain here tonight. Then you will be worse off than ever before.
David listened, and it worked. David’s supporters stayed with him and he returned to Jerusalem as king.