Yahya related to me from Malik from Zayd ibn Aslam that the Messenger of Allah ﷺ said, "The one riding greets the one walking, and when one of a group of people gives a greeting, it is enough for all of them."
أَنَّ رَسُولَ اللَّهِ ﷺ قَالَ يُسَلِّمُ الرَّاكِبُ عَلَى الْمَاشِي وَإِذَا سَلَّمَ مِنَ الْقَوْمِ وَاحِدٌ أَجْزَأَ عَنْهُمْ