Sunnah.com : Book 8, Hadith 10
Narration text is preserved in its supplied Arabic and English. Translated interfaces and reading guides do not add narration translations in other languages.
وَحَدَّثَنِي عَنْ مَالِكٍ، عَنْ نَافِعٍ، أَنَّ رَجُلاً، سَأَلَ عَبْدَ اللَّهِ بْنَ عُمَرَ فَقَالَ إِنِّي أُصَلِّي فِي بَيْتِي ثُمَّ أُدْرِكُ الصَّلاَةَ مَعَ الإِمَامِ أَفَأُصَلِّي مَعَهُ فَقَالَ لَهُ عَبْدُ اللَّهِ بْنُ عُمَرَ نَعَمْ . فَقَالَ الرَّجُلُ أَيَّتَهُمَا أَجْعَلُ صَلاَتِي فَقَالَ لَهُ ابْنُ عُمَرَ أَوَذَلِكَ إِلَيْكَ إِنَّمَا ذَلِكَ إِلَى اللَّهِ يَجْعَلُ أَيَّتَهُمَا شَاءَ .
Yahya related to me from Malik from Nafi that a man asked Abdullah ibn Umar, "Sometimes I pray in my house, and then catch the prayer with the imam. Should I pray with him?" Abdullah ibn Umar said to him, "Yes," and the man said, "Which of them do I make my prayer?" Abdullah ibn Umar said, "Is that up to you? It is up to Allah. He will decide on whichever of them He wishes."
Full reference and source
Sunnah.com : Book 8, Hadith 10 USC-MSA web (English) : Book 8, Hadith 10 Arabic : Book 8, Hadith 299
View source on Sunnah.com (opens in a new tab)