Source · the work in full

Rashi on the Prophets and Writings

CC BY · The Judaica Press Complete Tanach, trans. A. J. Rosenberg
Chapter 9

Ecclesiastes 9

and to clarify Heb. וְלָבוּר [like] וּלְבָרֵר.
all this I clarified and tested.
that the righteous and the wise and their works are in God’s hand He helps them and He judges them in order to benefit them in their end.
and their works These are their disciples, their servants, who follow in their ways.
even love, even hate The rest of mankind does not know, and they do not discern to apply their hearts to what makes them beloved by the Omnipresent and what causes them to be hated.
everything is before them before the righteous and the wise.

Everything as to all All take heart when an occurrence happens to someone, and they know that ultimately everyone will receive his just deserts.
one occurrence And they know that the end of everyone—whether righteous or wicked—is to die, and they all have one fate in this world. All this they know, but nevertheless, they choose for themselves the good way, because they know that there is a difference between them in the World to Come.
for the righteous such as Noah.
and for the wicked such as Pharaoh-Neco. This one became crippled, and that one became crippled.
for the good This is Moses.
and for the pure This is Aaron.
and for the unclean These are the Spies. These [Moses and Aaron] spoke well of the Land of Israel, but those spoke derogatorily about it. These did not enter the Land, and those did not enter the Land; hence, they have one fate.
and for he who sacrifices This is Josiah, as it is said: “And Josiah offered a sacrifice.”
and for he who does not sacrifice This is Ahab, who caused Israel to refrain from performing the festival pilgrimages. This one died from arrows, and that one died from arrows.
like the good This is David.
so is the sinner This is Nebuchadnezzar. This one built the Temple, and that one destroyed it. This one reigned forty years, and that one reigned forty years.
he who swears This is Zedekiah, who swore falsely, as it is said (II Chron. 36:13): “And he also rebelled against King Nebuchadnezzar, who adjured him, etc.”
like him who fears an oath This is Samson, as it is said (Jud. 15:12): “And Samson said to them: Swear to me, lest you strike me yourselves.” We learn that he was strict in his observance of an oath. [Nevertheless], this one died after his eyes were plucked out, and that one died after his eyes were plucked out. Therefore...

the heart of the children of men is full of evil for they say: There is no judgment of retribution for the wicked. Everything is pure happenstance. Sometimes [bad things happen] to the righteous, and sometimes to the wicked.
and after that, they go to the dead and they ultimately descend to Gehinnom.

For whoever is joined to all the living has hope For as long as he is alive, even if he is wicked and is joined to the wicked, as it is said: “to all the living”—even [if he is joined] to the wicked—he has hope, perhaps he will repent before his death.
for concerning a live dog he is better than a dead lion and they are both wicked. It was better for Nebuzaradan, who was a wicked slave and converted to Judaism, that death did not overtake him early, than for Nebuchadnezzar his master, who was called “lion,” as it is said (Jer. 4:7): “A lion has come up from his thicket,” who died in his wickedness, [and ended up] in Gehinnom, while his slave is in the Garden of Eden. Our Rabbis expounded upon this the rule that we may butcher a carcass for dogs on the Sabbath, but a human corpse, lying in the sun, may not be moved unless one places a child or a loaf of bread thereon.

For the living know that they will die and perhaps their hearts will return on the day of death and they will repent of their ways, but after they die, they do not know anything, and they have no more reward for the actions that they do from their deaths and onwards, for whoever toils on the eve of the Sabbath will eat on the Sabbath.

Also their love that they loved folly and scorn.
as well as their hate that they hated knowledge.
as well as their provocation that they provoked the Holy One, blessed be He, with the deeds of their hands.
and they have no more share, etc. in all that is done, etc. The merit of a son or daughter did not avail those wicked men who worshipped idols, and they have no atonement after death.

Go, eat your bread joyfully But you, the righteous man, whose good deeds the Holy One, blessed be He, has accepted, and who will merit the World to Come, go, eat, joyfully.

At all times, let your garments be white Prepare yourself at all times with good deeds, so that if you die today, you will enter in peace. And Solomon likened this to a man whom the king invited for a day of feasting, without setting a time for him. If he is wise or clever, he will immediately launder his garments, and bathe, and anoint himself. So did our Rabbis expound it in Tractate Shabbath (153a).

Enjoy life with the wife whom you love See and understand to learn a craft to earn a livelihood therefrom, together with the study of the Torah which you have acquired.
for that is your portion in life If you have done so, your share will be life in this world, by earning a livelihood from the craft, and in the World to Come, because toiling with both causes one to forget sin.

Whatever your hand attains to do the will of your Maker, as long as you have your strength, do.
for there is neither deed, etc. in the grave for your merit after you die, and if you did so, you have no reckoning in the grave to worry about. The verse is transposed, [to be explained]: for there is neither deed nor knowledge nor wisdom in the grave for the wicked, nor reckoning for the righteous, when the wicked give their accounting. So is it expounded in the Midrash (unknown). And one who interprets it without transposing it, according to its apparent meaning, interprets חֶשְּׁבּוֹן as an expression of “thought,” what he can still do to free himself from judgment.

I returned and saw Heb. וְרָאֹה, seeing, like זָכוֹר, vadant or vedant in Old French, (continually) looking.
the race does not belong to the swift Asahel’s swiftness did not avail him when his time arrived.
nor the war to the mighty Abner’s might did not avail him when his day arrived.
neither do the wise have bread For example, I (Solomon), whose bread for a day was (I Kings 5:2): “thirty kor of fine flour etc.,” and now, (above 2:10): “this was my portion from all my toil,” my staff and my cup.
nor do the understanding have riches e.g., Job, in the beginning, (Job 1:3): “His livestock consisted of, etc.,” and when his time came, he said, (ibid. 19:21): “Have pity on me, you, my friends.”
nor the knowledgeable, favor Moses, for example—there was no one more knowledgeable and wiser than he in Israel, and yet he did not find favor with his prayer to enter the Land.
for time and fate as its apparent meaning. Another explanation: for time will befall them, and they should be accustomed to entreaty (פְּגִיעָה) and supplication, that these things should not befall them.

like the fish that are caught with an inferior trap Like large fish that are caught in an inferior and weak trap, and our Rabbis (Ecc. Rabbah) explained: This is a fishhook, which is no more than a sort of needle, yet a large fish is caught with it.
like them, the children of men are trapped with a small and weak trap, like the weak trap and the snare. People stumble at the time of the visitation of their evil, when the time comes for evil to fall upon them suddenly, in an inferior trap, malvayse in Old French, bad, evil.
like them Heb. כָּהֵם, כְּמוֹתָם.

but no man remembered No one attributed any importance to him.

And I said when I saw this, “Wisdom is better than might,” for this one’s wisdom was despised by all, but now, they were all rescued through him. The Midrash Aggadah, [however, explains the verses as follows]:
[14] [There was] a small city This is the body.
with few people in it These are the limbs of a person.
a great king This is the evil inclination, which all his limbs feel.
[15] a poor man This is the good inclination.

are heard [when spoken] softly They are accepted by mankind.
more than the shout of a ruler of fools Moses passed away many years ago, but his decrees are still accepted by Israel, and how many kings of the nations make decrees over Israel, but their words are not accepted.

Wisdom is better This refers to the wisdom of Serah, of whom it is said (II Sam. 20:22): “And the woman came to all the people in her wisdom,” [which] availed them more than the weapons that were in their hands, to fight with Joab.
and one sinner destroys much good Had she not slain Sheba the son of Bichri, they would all have been destroyed by him. (Ecc. Rabbah).
Another explanation: and one sinner destroys much good If Israel were [composed] half of righteous people and half of wicked ones, and one person came and sinned, making the wicked the majority, the result would be that he weighed them all down to the guilty side.

You arrive at the cited line; the whole work is yours to read around it. The text is set from the cited public-domain edition.