Does your answer add value? Is someone who comes along and finds this question, when they have a similar problem, going to be better off reading both your answer and the other answer, or would they be better off just reading the other answer?
If it's not quite as good, but it still adds value, keep it around. If it honestly adds no value, or worse, if it adds negative value, then delete it. Keep in mind that there are a lot of ways for an answer to add negative value. Reading answers takes time; if you think that the answer is worse than others, and everyone who reads it will think, "well I can't get those 2 minutes of my life back," even if the answer works, it's still not adding value. On the other hand, if it contains some information that you think others would find useful, that isn't found in other answers, or if there is a small handful of people that your answer would help that another answer wouldn't (a common example of this would be if your answer works on an older version of a product) then that could be how it adds value.