The moral of the story is obvious: God wants us to be ourselves. If we were supposed to be more like someone else, God would have created us with their personal qualities. Instead, He gave each of us a specific type of personality, along with a certain set of talents, that would enable us to fulfill our individual mission in life. Each one of us has everything we need to succeed in that particular mission, and whatever we don't have yet can be attained through hard work and dedication. Nobody is good at everything, but everybody is good at something. We should simply develop whatever skills we do have to the best of our ability, and not worry about what someone else is doing. If we truly inculcate this value, jealousy will slowly cease to exist.
Unfortunately, human nature makes us believe that the grass is greener on the other side. Perhaps we think that another person's marriage is better, or their physical appearance is more attractive, or they have a better financial situation, or are smarter than us - the list is endless! To ponder such things is a waste of time, not to mention a complete exercise in futility. There is another famous Chasidic tale which states that if everyone put their troubles into a hat - and had to choose between their own and those of others - everyone would choose the ones they already have. It's important to remember that all people have problems, whether physical, financial, interpersonal or otherwise. Consequently, if you think someone else's life is perfect, that only shows you don't really know them.
So how can we stop comparing ourselves to other people? Rashi's commentary on the words "U'vo Tidbakun" - "And to Him shall you cleave" (Deuteronomy 13:5) provides us with a possible answer. Rashi states that the only way a human being can cleave to God is by emulating His characteristics. Just as He performs kind deeds, so should we; just as He buries the dead (as in the case of Moses), so should we; and just as He visits the sick (as in the case of Abraham), so should we. In other words, our actions should only be compared to those of God - not other people. Because, ultimately, God only wants you to be [insert your name here].