In our reading of First Chronicles chapter 21 this week we cover King David’s sinful numbering of the people. We’ve included two links below. First, why was his command sinful and secondly, how is it that in 2 Samuel 24:1, it is recorded that the anger of the Lord was kindled against Israel, and he moved David against them to say, “Go number Israel and Judah.” And then the same incident is recorded by the scribes says, that “Satan stood up against Israel, and provoked David to number Israel.”
This is often called a Bible contradiction. However, upon a closer examination we discover it is rather like the perspective of a crime shared by two witnesses. The second link will give you a better understanding of this phenomenon and how we can be lead astray by our own limited perspective as we might be tempted to jump to the conclusion that the Bible is inaccurate without a careful reading of the text and an understanding of how the Bible interprets itself.
https://www.gotquestions.org/David-census.html
https://www.premier.org.uk/Topics/Church/Apologetics/Who-moved-King-David-to-number-Israel