There is futility which is done on the earth, that is, there are righteous men to whom it happens according to the deeds of the wicked.
On the other hand, there are evil men to whom it happens according to the deeds of the righteous.
I say that this too is futility.
So I commended pleasure, for there is nothing good for a man under the sun except to eat and to drink and to be merry, and this will stand by him in his toils throughout the days of his life which God has given him under the sun.
When I gave my heart to know wisdom and to see the task which has been done on the earth (even though one should never sleep day or night), and I saw every work of God, I concluded that man cannot discover the work which has been done under the sun.
Even though man should seek laboriously, he will not discover; and though the wise man should say, “I know,” he cannot discover.
For I have taken all this to my heart and explain it that righteous men, wise men, and their deeds are in the hand of God. Man does not know whether it will be love or hatred; anything awaits him.
It is the same for all. There is one fate for the righteous and for the wicked; for the good, for the clean and for the unclean; for the man who offers a sacrifice and for the one who does not sacrifice. As the good man is, so is the sinner; as the swearer is, so is the one who is afraid to swear.
This is an evil in all that is done under the sun, that there is one fate for all men.
Furthermore, the hearts of the sons of men are full of evil and insanity is in their hearts throughout their lives. Afterwards they go to the dead.
For whoever is joined with all the living, there is hope; surely a live dog is better than a dead lion.
For the living know they will die; but the dead do not know anything, nor have they any longer a reward, for their memory is forgotten. Indeed, their love, their hate, and their zeal have already perished, and they will no longer have a share in all that is done under the sun.
Go then, eat your bread in happiness and drink your wine with a cheerful heart; for God has already approved your works. Let your clothes be white all the time, and let not oil be lacking on your head. Eccl 8:12-17, 9:1-8