Since you simply didn't ask the question that you had intended to ask, leave the existing question alone and ask the question that you now realize you ought to have asked.
While the original question may not have been what you really wanted to know, as long as it's an appropriate, on topic, and sensible question, you should leave it. Someone else may benefit from it, even if you wouldn't.
Had the answer simply misunderstood the question that you were asking all along, then editing the question to better clarify what it has always been would be okay, even though the result it that it becomes clearer to readers that the answer misunderstands the question. In your case though, since the problem is not a misunderstood question, but an improperly asked question, this would not be appropriate.