David mustered the men who were with him and appointed over them commanders of thousands and commanders of hundreds.
References for 2 Samuel 18:1
David sent the troops out1--a third under the command of Joab, a third under Joab's brother Abishai2 son of Zeruiah, and a third under Ittai3 the Gittite. The king told the troops, "I myself will surely march out with you."
References for 2 Samuel 18:2
But the men said, "You must not go out; if we are forced to flee, they won't care about us. Even if half of us die, they won't care; but you are worth ten4 thousand of us. It would be better now for you to give us support from the city."5
References for 2 Samuel 18:3
The king answered, "I will do whatever seems best to you." So the king stood beside the gate while all the men marched out in units of hundreds and of thousands.