“This is what the Lord says: ‘Let the record show that this man Jehoiachin was childless. He is a failure, for none of his children will succeed him on the throne of David to rule over Judah.’” (Jeremiah 22:30 NLT).

THE AMAZING ACCURACY OF SCRIPTURE
The Lord gave Jeremiah this prophecy concerning Jehoiachin, grandson of King Josiah, that he would be childless. The prophecy further explained that his childlessness would not be due to not having any sons, but that none of them would sit on David’s throne. Indeed, Jehoiachin was taken into Babylonian captivity, where he had children, among them was his grandson, Zerubabbel, who later returned to Jerusalem, not as a king, but as a leader who lead in the rebuilding of the Temple. So, Jeremiah’s prophecy was fulfilled. No one from Jehoiachin’s line has ever sat on David’s throne.
 
Yet, if this is so, how would God fulfill His promise to David that the Messiah would come from his line, so that he always had a son to sit on his throne? In addition, what of Matthew’s genealogy that seems to state that Jesus was indeed born into Jehoiachin’s line (Jehoiachin was also called Jeconiah as in Matt. 1:12)? Doesn’t this show that Jeremiah’s prophecy was inaccurate?
 
The answer to the questions concerning Matthew’s genealogy is that it gives the line of Joseph, so that Jesus has legal claim to David’s throne through His stepfather.
 
And the answer to how Jesus can claim human descent from David is found in Luke 3:31, where the line of Jesus is traced through Mary’s line to David’s son, Nathan, the older brother of Solomon.