326. What is the correct genealogy from David to Jesus?

Here is the genealogy from the gospel of Matthew: (Matthew starts with David and ends with Jesus.)
David the king begat Solomon of her that had been the wife of Urias; And Solomon begat Roboam; and Roboam begat Abia; and Abia begat Asa; And Asa begat Josaphat; and Josaphat begat Joram; and Joram begat Ozias; And Ozias begat Joatham; and Joatham begat Achaz; and Achaz begat Ezekias; And Ezekias begat Manasses; and Manasses begat Amon; and Amon begat Josias; And Josias begat Jechonias and his brethren, about the time they were carried away to Babylon: And after they were brought to Babylon, Jechonias begat Salathiel; and Salathiel begat Zorobabel; And Zorobabel begat Abiud; and Abiud begat Eliakim; and Eliakim begat Azor; And Azor begat Sadoc; and Sadoc begat Achim; and Achim begat Eliud; And Eliud begat Eleazar; and Eleazar begat Matthan; and Matthan begat Jacob; And Jacob begat Joseph the husband of Mary, of whom was born Jesus, who is called Christ. Matthew 1:6-16
And here is the (supposedly same, but actually completely different) genealogy from Luke:
(Luke starts with Jesus and goes back to David.)
And Jesus himself began to be about thirty years of age, being (as was supposed) the son of Joseph, which was the son of Heli, Which was the son of Matthat, which was the son of Levi, which was the son of Melchi, which was the son of Janna, which was the son of Joseph, Which was the son of Mattathias, which was the son of Amos, which was the son of Naum, which was the son of Esli, which was the son of Nagge, Which was the son of Maath, which was the son of Mattathias, which was the son of Semei, which was the son of Joseph, which was the son of Juda, Which was the son of Joanna, which was the son of Rhesa, which was the son of Zorobabel, which was the son of Salathiel, which was the son of Neri, Which was the son of Melchi, which was the son of Addi, which was the son of Cosam, which was the son of Elmodam, which was the son of Er, Which was the son of Jose, which was the son of Eliezer, which was the son of Jorim, which was the son of Matthat, which was the son of Levi, Which was the son of Simeon, which was the son of Juda, which was the son of Joseph, which was the son of Jonan, which was the son of Eliakim, Which was the son of Melea, which was the son of Menan, which was the son of Mattatha, which was the son of Nathan, which was the son of David. Luke 3:23-31
And here's a table that highlights the differences between them.
Genealogy from David to Jesus
Matthew 1:6-16
David
Solomon
Roboam
Abia
Asa
Josaphat
Joram
Ozias
Joatham
Achaz
Ezekias
Manasses
Amon
Josias
Jechonias
Salathiel
Zorobabel
Abiud
Eliakim
Azor
Sadoc
Achim
Eliud
Eleazar
Matthan
Jacob
Joseph
Jesus
Luke 3:23-31
David
Nathan
Mattatha
Menan
Melea
Eliakim
Jonan
Joseph
Juda
Simeon
Levi
Matthat
Jorim
Eliezer
Jose
Er
Elmodam
Cosam
Addi
Melchi
Neri
Salathiel
Zorobabel
Rhesa
Joanna
Juda
Joseph
Semei
Mattathias
Maath
Nagge
Esli
Naum
Amos
Mattathias
Joseph
Janna
Melchi
Levi
Matthat
Heli
Joseph
Jesus


Christian Response
gotQuestions.org
CARM
About Religion
CRI

Brief Bible Blunders

A sober look at Biblical problems
Genealogies in Matthew and Luke contradict each other