The actual joke is never told. Here is the transcript from Generations:
DATA: Ha, ha, ha! I get it. Ha. ha, ha! I get it.
LAFORGE: You get what?
DATA: When you said to Commander Riker 'The clown can stay...' Ha, ha, ha. '...but the Ferengi in the gorilla suit has to go.' Ha, ha, ha.
LAFORGE: What are you talking about?
DATA: During the Farpoint mission. We were on the bridge and you told the joke. That was the punch line. Ha, ha, ha!
LAFORGE: Farpoint? Data, that was seven years ago.
DATA: I know. I just got it. Ha, ha, ha, ha, ha! Very funny! Ha, ha, ha...
Since the joke was told off screen in the Pilot, and only the punchline is told in Generations, we will never know what this joke was. Based on the punchline I suspect it wasn't very good though.