This is part of a series of questions regarding the Braisa in Avos d'Rebbi Nassan 16:2 that lists how Yosef HaTzaddik, R' Tzadok, R' Akiva, and R' Eliezer HaGadol were able to overcome their inclination to sin.
The Braisa claims that each person on the list was greater than the previous one. In R' Tzadok's story, he was enslaved and imprisoned with a maidservant, but rather than sinning with her, he stared at the wall and learned Torah orally. When asked by his mistress why he didn't sin, he said he was descended from Kohanim Gedolim and was from a prominent family, and furthermore, he would produce mamzeirim from this union. Impressed by his answer, his mistress freed him with great honor.
How is that greater than Yosef? Great, perhaps, but is a one-night challenge greater than a daily challenge?