Sad endings are as valid as happy endings, when they fit the story.
Granted, some sad endings are just shoehorned in to give the story a false sense of Depth? (looking at you, Chinatown), but likewise, many happy endings are just pulled right out of the writers' asses (or, more often, out of the publishers/studio heads' asses, because "The Masses won't pay as much money for a work that doesn't have a happy-funtime ending!"), so if it doesn't work, it doesn't work. But if it works, if it fits with the thematic elements of the story and is logical, then a sad ending is good.
Of course, there is the fact that one of the primary purposes of fiction is to ESCAPE from the cruel reality of the world, so happy funtime endings are not a bad thing... but there's room for all kinds of fiction.
(on the other hand, I did think the ending of Andersen's The Little Mermaid was bullshit...)