(a) It is narrated from Yahya bin Sa'id (may Allah have mercy on him) that a man asked Sa'id bin al-Musayyib (may Allah have mercy on him): I pray at home, then I come to the mosque and find the imam praying; should I pray with the imam as well? Sa'id bin al-Musayyib (may Allah have mercy on him) said: Yes. He then said: Which of them should I consider obligatory? Sa'id (may Allah have mercy on him) said: Is it you who can make it so? That is in Allah's hands; He makes whichever of them He wills (the obligatory one).
(b) The first view is more correct in light of the hadith of Sayyiduna Abu Dharr and Sayyiduna Yazid bin al-Aswad (may Allah be pleased with them both).
(c) Uthman bin Ubaydullah bin Abi Rafi' (may Allah have mercy on him) said: I asked Sayyiduna Ibn Umar (may Allah be pleased with them both) about repeating the prayer, and he said: The first is counted as the obligatory one.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصلاة / 3650