King Laius and his attendants were on their way to Delphi to consult the oracle. On they're way, they encountered Oedipus, who was trying to avoid the oracle and fee Polybus and Merope. Oedipus, not being compliant to Laius' orders, became mad and killed all the attendants except one, who ran away.
After killing Laius, Oedipus had met up with the Sphinx. In order to pass into Thebes from Delphi, he would have to answer her riddle. If he were to fail, it would result in his death. The riddle said, "What walks on four feet in the morning, two feet in the afternoon, and three feet at night?" Oedipus answered correctly with "man", and was able to pass into Thebes
After solving the riddle and going into Thebes, Oedipus was also rewarded with the hand of Jocasta, Queen of Thebes and Laius' wife. He began to rule Thebes alongside her, slowly discovering that the oracle was very true.