Riyad as-SalihinChapter 12Hadith 712
Full Sharh — Riyad as-Salihin 712
وعنه قال: قال رسول الله صلى الله عليه وسلم : "من تعلم علمًا مما يبتغى به وجه الله عز وجل لا يتعلمه إلا ليصيب به غرضًا من الدنيا لم يجد عرف الجنة يوم القيامة" ((يعني ريحها))، ((رواه أبو داود بإسناد صحيح. )).
English Translation
Abu Hurairah (May Allah be pleased with him) reported:: The Messenger of Allah(ﷺ) said, "He who does not acquire knowledge with the sole intention of seeking the Pleasure of Allah but for worldly gain, will not smell the fragrance of Jannah on the Day of Resurrection.".
Source
Riyad as-Salihin(رياض الصالحين)
The Book of Knowledge
Hadith Number
712