Abdullah bin Sarjis (may Allah be pleased with him) said: A man entered the mosque while the Messenger of Allah (peace and blessings be upon him) was leading the morning prayer. He prayed two rak'ahs before joining the congregation. When the Messenger of Allah (peace and blessings be upon him) finished the prayer, he (peace and blessings be upon him) said: "O so-and-so! Which of your two prayers will you count: the one you prayed alone, or the one you prayed with us?"
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصلاة / 4544