Ecclesiastes 2:26

2:26 For to the man who pleases him, God gives wisdom, knowledge, and joy; but to the sinner he gives travail, to gather and to heap up, that he may give to him who pleases God. This also is vanity and a chasing after wind.
-World English Bible

Other Translation

2:26 For [God] giveth to a man that [is] good in his sight wisdom, and knowledge, and joy: but to the sinner he giveth travail, to gather and to heap up, that he may give to [him that is] good before God. This also [is] vanity and vexation of spirit.
-King James Version