Al-Adab Al-Mufrad, Book 42, Hadith 1007 (English)

Abu Hurayra reported that the Messenger of Allah, may Allah bless him and grant him peace, said, "When one of you comes to a gathering, he should give the greeting. If he leaves, he should give the greeting. Neither is more of a duty than the other."

حَدَّثَنَا أَبُو عَاصِمٍ، عَنِ ابْنِ عَجْلاَنَ، عَنْ سَعِيدٍ الْمَقْبُرِيِّ، عَنْ أَبِي هُرَيْرَةَ قَالَ‏:‏ قَالَ رَسُولُ اللهِ صلى الله عليه وسلم‏:‏ إِذَا جَاءَ أَحَدُكُمُ الْمَجْلِسَ فَلْيُسَلِّمْ، فَإِنْ رَجَعَ فَلْيُسَلِّمْ، فَإِنَّ الأُخْرَى لَيْسَتْ بِأَحَقَّ مِنَ الأولَى‏.‏

sunnah.com