Ecclesiastes 2:22

20 Therefore I went about to cause my heart to despair of all the labour which I took under the sun.

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.

For what hath man of all his labour, and of the vexation of his heart, wherein he hath laboured under the sun?

23 For all his days are sorrows, and his travail grief; yea, his heart taketh not rest in the night. This is also vanity.

24 There is nothing better for a man, than that he should eat and drink, and that he should make his soul enjoy good in his labour. This also I saw, that it was from the hand of God.

Do read the surrounding verses too, because the context often says more than a single verse.

Compare

BSB
For what does a man get for all the toil and striving with which he labors under the sun?
KJV
For what hath man of all his labour, and of the vexation of his heart, wherein he hath laboured under the sun?
WEB
For what does a man have of all his labor and of the striving of his heart, in which he labors under the sun?
ASV
For what hath a man of all his labor, and of the striving of his heart, wherein he laboreth under the sun?
DARBY
For what will man have of all his labour and of the striving of his heart, wherewith he hath wearied himself under the sun?
BLB
For what has been for the man for all his toil and for the striving of his heart, with which he toils under the sun?
ÅB
For hva har mennesket for alt sitt strev og for sitt hjertes attrå, som han møyer seg med under solen?
OTB
Hva får mennesker ut av alt sitt strev og sin bekymrede streben som de arbeider med under solen?
B1930
For hvad har mennesket for alt sitt strev og for sitt hjertes attrå, som han møier sig med under solen?

Study notes (Tyndale)

Original text and word study

Cross references