مشكوة المصابيح Mishkat al-Masabih كتاب الصلاة The Book of Prayer
(إِذَا حَضَرَ الْمَسْجِدَ فَصَلَّى مَعَ الْجَمَاعَةِ وَلَوْ صَلَّى فِي الْبَيْتِ)

(If one comes to the mosque and finds the congregation, he should pray with them even if he has prayed at home)

1 hadith
Hadith 1154
وَعَنْ رَجُلٍ مِنْ أَسَدِ بْنِ خُزَيْمَةَ أَنَّهُ سَأَلَ أَبَا أَيُّوبَ الْأَنْصَارِيَّ قَالَ: يُصَلِّي أَحَدُنَا فِي مَنْزِلِهِ الصَّلَاةَ ثُمَّ يَأْتِي الْمَسْجِدَ وَتُقَامُ الصَّلَاةُ فَأُصَلِّي مَعَهُمْ فَأَجِدُ فِي نَفْسِي شَيْئًا من ذَلِك فَقَالَ أَبُو أَيُّوبَ: سَأَلَنَا عَنْ ذَلِكَ النَّبِيُّ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ قَالَ: «فَذَلِكَ لَهُ سَهْمُ جَمْعٍ» . رَوَاهُ مَالِكٌ وَأَبُو دَاوُد
A man of Asad b. Khuzaima said he put this question to Abu Ayyub al-Ansari:I* pray at home and then go to the mosque and the time to begin the prayer comes, so I pray along with the congregation, but I feel some uneasiness about that. Abu Ayyub replied, “We asked the Prophet about that and he said that such a person gets a portion of the reward for corporate prayer.” * The Arabic has “One of us prays . . . then goes . . .” After that the first person singular is used. While such a construction is quite usual in 'Arabic, it makes impossible English, so I have used the first person all through. Malik and Abu Dawud transmitted it.
Hadith Reference Mishkat al-Masabih / The Book of Prayer / Hadith: 1154
Hadith Grading الألبانی: ضَعِيف  |  زبیر علی زئی: إسناده ضعيف
Hadith Takhrij ´تحقيق و تخريج: محدث العصر حافظ زبير على زئي رحمه الله` «إسناده ضعيف، رواه مالک (1/ 133 ح 297) و أبو داود (578) ¤٭ رجل من أسد بن خزيمة: لم أعرفه.»