Ecclesiastes 2:21

For there is a man whose labour is in wisdom, and in knowledge, and in equity; yet to a man that hath not laboured therein shall he leave it for his portion. This also is vanity and a great evil.

The verse belongs to Solomon's account of testing worldly pleasure, in which with his wisdom and resources he pursued every desire and undertook great works. That course included his labor and worldly success and the enlargement of Jerusalem. The surrounding chapter shows that greatness and happiness do not always go together, making the verse a reminder against pride. It forms part of Solomon's conclusion that worldly pleasure and gain are vanity and vexation of spirit.

Even labor done in wisdom and knowledge and equity, to accumulate wealth and competence through toil full of cares, leaves its results as a portion to one who has not labored therein, and this also is vanity and a great evil. It illustrates the mutability of this sinful world where men are born and live and die. Wealth hoarded through life may be wasted in its later disposition and spent by others who did not earn it. Even what a good and respected man labored for may pass to an unworthy heir and to ruin, while he has had little time for the life beyond.

The verse therefore warns to use wealth for good while there is opportunity rather than hoarding it through life. A tranquil life with trust in God though possessing little of this world's goods is better than possessing all this world can give yet dying poor of the true riches.