Ecclesiastes 2:18

Then I hated all my labor in which I had toiled under the sun, because I must leave it to the man who will come after me.

Surrounding context

2:17 Therefore I hated life because the work that was done under the sun was distressing to me, for all is vanity and grasping for the wind.

2:18 Then I hated all my labor in which I had toiled under the sun, because I must leave it to the man who will come after me.

2:19 And who knows whether he will be wise or a fool? Yet he will rule over all my labor in which I toiled and in which I have shown myself wise under the sun. This also is vanity.

Translation and sources