I asked Anas bin Malik, "Who compiled the Quran during the time of the Prophet ﷺ?"He replied, "Four men, all of them from the Ansar. Ubayy bin Kaab, Muaz bin Jabal, Zayd bin Thabit, and Abu Zayd."
سألت أنس بن مالك: من جمع القرآن على عهد النبي ﷺ؟ قال: أربعة كلهم من الأنصار: أبي بن كعب، ومعاذ بن جبل، وزيد بن ثابت، وأبو زيد.
Bukhari narrated it in the Virtues of the Quran (5003), from Hafs bin Umar, who said, Hammam narrated to us, who said, Qatada narrated to us, who said, I asked Anas, and he mentioned it.Bukhari (3810) and Muslim in the Virtues of the Companions (2465) both narrated it from the hadith of Shuba, from Qatada, who said, I heard Anas saying it, and he mentioned it.Qatada said, "I asked Anas bin Malik, 'Who is Abu Zayd?' He said, 'One of my paternal uncles.'"These are four men from the Ansar, and before them came two from the Muhajirun and two from the Ansar. This shows that the Prophet ﷺ said this on different occasions, so there is no contradiction between these hadiths.