Although popularly associated with the 1942 film Casablanca, the song "As Time Goes By" was written by Herman Hupfeld for the 1931 Broadway musical Everybody's Welcome, where it was sung by Frances Williams.
In 1938, Murray Bennett visited a nightclub in the south of France where a black pianist played jazz to a crowd of refugees, Nazis, and the French, which inspired him to write a screenplay he entitled Everybody Comes to Rick's (which became Casablanca). Producer Hal Wallis and composer Max Steiner after seeing the finished film thought an original song would suit the film better (and would earn royalties for Steiner), but that would mean re-shooting scenes that referred to "As Time Goes By," and Ingrid Bergman had already moved on to another picture, so the song stayed in.
Dooley Wilson, who plays Sam and sings the song, was a drummer. His piano was a dummy, and Elliot Carpenter played the song live off-camera.
In 1943, with the release of Casablanca, the song played on Your Hit Parade for 21 straight weeks, and a re-issue of Rudy Vallee's 1931 recording was a major seller.