Again the anger of the Lord was kindled against Israel, and he incited David against them, saying, "Go, count the people of Israel and Judah."
So the king said to Joab and the commanders of the army, who were with him, "Go through all the tribes of Israel, from Dan to Beer-sheba, and take a census of the people, so that I may know how many there are."
References for 2 Samuel 24:2
But Joab said to the king, "May the Lord your God increase the number of the people a hundredfold, while the eyes of my lord the king can still see it! But why does my lord the king want to do this?"
But the king's word prevailed against Joab and the commanders of the army. So Joab and the commanders of the army went out from the presence of the king to take a census of the people of Israel.
They crossed the Jordan, and began from Aroer and from the city that is in the middle of the valley, toward Gad and on to Jazer.
References for 2 Samuel 24:5
Then they came to Gilead, and to Kadesh in the land of the Hittites; and they came to Dan, and from Dan they went around to Sidon,
References for 2 Samuel 24:6
and came to the fortress of Tyre and to all the cities of the Hivites and Canaanites; and they went out to the Negeb of Judah at Beer-sheba.
So when they had gone through all the land, they came back to Jerusalem at the end of nine months and twenty days.
Joab reported to the king the number of those who had been recorded: in Israel there were eight hundred thousand soldiers able to draw the sword, and those of Judah were five hundred thousand.