The Q source is a hypothetical written or oral collection of Jesus’ sayings that was common to the Gospels of Matthew and Luke but not in the Gospel of Mark. This Q source included many parables and the beatitudes. According to this hypothesis, these sayings of Jesus was taken from the early Church’s oral tradition. In the 19th century, some New Testament scholars favored Mark as the first written gospel. They assumed that that the authors of Matthew and Luke had used the Gospel of Mark. However, there were large sections of the gospels of Luke and Matthew that were not found in Mark. They suggested that neither gospel drew upon each other, but from a second common source, termed Q, from the German word Quelle. Many scholars have tried to reconstruct this lost source with limited success. Another group of scholars thought that the 20th century discovered Gospel of Thomas might be that source. Others have maintained that this similarity also demanded a written rather than an oral document. Did Q even predate the Gospel of Mark? Another question is whether Luke used Matthew instead of having a common source, the older hypothesis.
Dating an ancient document is never an exact science. However, today general scholarship about the New Testament books holds that the short Gospel of Mark was the oldest Gospel. The first letter of Paul to the Thessalonians was the oldest document, from around the year 50 CE. Mark, with a hypothetical other source (Q=Quelle) that is now lost, became the source for the Gospels of Matthew and Luke. The Gospel of John was generally considered to be the last of the gospels, around 90 -100 CE.