Myths like this have always made me kinda angry. Anybody that has owned fish for more than a few days could easily say that this isn't true at all.
But aside from that - animals simply wouldn't exist if they were that stupid. The world is a dangerous place, especially underwater. Not having even basic memory and pattern recognition would be a one-way flight to extinction.
Fish do too. Fish have pressure sensors down the lengths of their bodies they use for navigation, sensing prey and predators, and communicating.
My gouramis are making clicking noises in their tank as I type this. Love those things.