Sunan al-Darimi 260
أَخْبَرَنَا مَخْلَدُ بْنُ مَالِكٍ، حَدَّثَنَا مَخْلَدُ بْنُ حُسَيْنٍ، عَنْ هِشَامٍ، عَنِ الْحَسَنِ، قَالَ: «مَنْ طَلَبَ شَيْئًا مِنْ هَذَا الْعِلْمِ فَأَرَادَ بِهِ مَا عِنْدَ اللَّهِ، يُدْرِكْ إِنْ شَاءَ اللَّهُ، وَمَنْ أَرَادَ بِهِ الدُّنْيَا، فَذَاكَ وَاللَّهِ حَظُّهُ مِنْهُ»
Makhlad ibn Malik informed us; he said: Makhlad ibn Husayn narrated to us, from Hisham, from al-Hasan, who said: "Whoever seeks something of this knowledge and intends by it what is with Allah will attain it, if Allah wills. And whoever intends by it this world, then that, by Allah, is his share of it."