So the king said to Joab, the commander of the army, who was with him, "Go through all the tribes of Israel, from Dan to Beersheba, and number the people, that I may know the number of the people."