24

While trying to find a solution to a very specific problem I came across this question Does T-SQL have an aggregate function to concatenate strings? and found it strange that it is marked as a duplicate.

Sure there are plenty questions that ask about a similar thing, but it's not entirely the same. Other questions mainly ask "How to solve X?" this one asks "Can I solve X using Y?" (explicitly asking about a specific method). Other questions get answers like "Use A", but this one got "No, try using A instead" and "Yes, use this B" (IMHO very good and ontopic answer in the context of the question). In theory the second answer from the question could possibly also work in the "How to solve X?" questions (in fact this answer is very similar), but in case of this question it seems to make even more sense. However now that the question is marked as a duplicate no more answers like the second one can be posted (I imagine different takes on the second answer are more than possible).

So is this question really a duplicate?

P.S. It feels a bit like assuming that "Can I buy a car?" and "What vehicle to buy?" are the same question because answers, "No, buy a bike" and "Yes, buy this cheap used car" can sort of work for both questions.

P.S.2 Although the OP asked his question explicitly as "Can I solve X using Y?" (both title and content), based on the answer he selected, he might have meant "How to solve X?" all along. On the other hand, being unsatisfied with the "How to solve X?" questions I was considering asking my own, which would amount to writing the same thing the OP wrote (but I ended up finding his question instead).

3
  • 2
    Note: even the OP thinks it's a duplicate, and VTC'd on their own question.
    – user3920237
    Feb 24, 2015 at 12:53
  • @remyabel That would mean that I my P.S.2 was correct. My point was sometimes asking "how to solve problem X using method Y" is a valid question (a question that has a valid answer) even if the answers are technically a subset of the answers to the "how to solve problem X". The question mentioned in my question might have not been the best example, but I got my revelation because of it ;)
    – jahu
    Feb 24, 2015 at 13:05
  • I think these kind of duplicate closings are acceptable if the target is a very good canonical question on X, and also features a well-written answer about Y.
    – Bergi
    Feb 26, 2015 at 1:42

4 Answers 4

23

In most cases "How to do X with Y" is case of XY problem and author just want X, or often something that includes/relates to X.

It is perfectly valid to close such question as duplicate of "How to do X" unless author demonstrated good understanding of other options. Something like:

I need to do X in FoooBrrr, the answer ... shows how to do this with Z but in my environment Z is not possible. In Java I would alternatively use Y to achieve X, but I could not find Y in FoooBrrr.

3
  • I really shouldn't be doing X because Y is confusing the hell out me and I've no idea what Zs problem is!?!
    – user692942
    Feb 25, 2015 at 16:37
  • If you do close it as duplicate, consider editing the title of the question to make it more general, to avoid the problem @5gon12eder is talking about.
    – Flimm
    Feb 26, 2015 at 15:40
  • 1
    @Flimm - good point, but also double-edged sword - you'd want to make it more generic, but also not lose value of the title to be searchable link to good answer. I.e. "use hammer to drive screw ..." should not be edited to just "drive screw ..." as it loses the Y part of "How to do X with Y" (assuming "How to do X" is already easily searchable and gives duplicate's target as result). Feb 26, 2015 at 16:02
17

Thinking about community value, if I do a web search for “Can I use a hammer to drive screws into wood?” and find a SO question that is closed as a duplicate of “How to drive screws into wood?” where the accepted answer suggests using an appropriate screwdriver, I will benefit more than from an answer to the original question that shows a “cool hack” how to accomplish the impossible. On the other hand, if the question is closed as a duplicate of “How to fasten things in wood?” where the accepted answer suggests using a hammer to drive in nails, future visitors will be mislead.

So I would vote for duplicate if the related question shows a best-practice solution that is evidently better suited than what the OP thinks might be a way to go and therefore asks how to do. If I have doubts that the related question is applicable in the OP's situation, I'd probably refrain from close-voting and write an answer like “You could use Y but it is cumbersome. Many people use Z (link to related question) but in your situation, I think that W would be most effective, unless you re-design V.” instead. Of course, as Alexei Levenkov points out, if the OP has already demonstrated that Z cannot be used in their situation, then voting for a duplicate that recommends Z is not appropriate.

4
  • As I mentioned in some comment already. I kind of got confused with the question. Using your example it would be something like: I needed to hammer screws, found a question asking about it that looked mostly valid and found it odd that it was closed as a duplicate of "how to drive screws into wood". In other words I was looking for this "hammer hack". So my point was if someone asks about the "hammer hack" that lets you hammer screws it's not really a duplicate of "how to drive screws into wood". However frequently questions about hammering screws are the typical XY ones.
    – jahu
    Feb 26, 2015 at 9:37
  • Obviously the question isn't a perfect example, because the OP just needed to use a screwdriver and it was an XY question. I guess meta.stackoverflow.com/questions/254341/… already covers the subject of my question here. Incidentally the question in umm... question(?) makes more sense than hammering screws and one of the answers explains how it can actually be done (and is very appreciated by people looking for the "hammer hack").
    – jahu
    Feb 26, 2015 at 9:50
  • I don't know enough about SQL to confidently judge about the specific question you have linked to so I went with a general analogy. If you really mean to ask for a “hammer hack”, I think Alexei Levenkov has pointed out a good way to ask for it that won't be subject to dupe-closing and will also not mislead future readers because the best practice answer is already mentioned as a possible solution (though not applicable in this particular case).
    – 5gon12eder
    Feb 26, 2015 at 10:56
  • I would add that if the answers on "how to do X" don't mention Y at all, then the question isn't a dupe for the same reason that "no" wouldn't be a good answer to "can I solve X with Y?" If someone has enough reason to think Y might be useful, then they'll benefit from finding an answer that explains why it isn't. I suppose if Y is a completely stupid suggestion, for reasons that the answer to "how to do X?" makes clear without actually mentioning Y, then that's OK to dupe. Feb 26, 2015 at 17:33
5

Sure there are plenty questions that ask about a similar thing, but it's not entirely the same.

There are endless permutations of Y that can mean X. The actual question OP is asking:

I need to write a query that groups BuildingNames together and displays a list of PollNumbers like this:

BuildingName    PollNumbers
------------    -----------
Foo Centre      12, 13, 14
Bar Hall        15, 16
Baz School      17

How can I do this in T-SQL?

The rest is what they think is a possible solution to the problem.

However now that the question is marked as a duplicate no more answers like the second one can be posted (I imagine different takes on the second answer are more than possible).

You can still post answers in the duplicates since they are not closed.

So is this question really a duplicate?

The OP was one of the close voters, indicating that X was their true question.

P.S. It feels a bit like assuming that "Can I buy a car?" and "What vehicle to buy?" are the same question because answers, "No, buy a bike" and "Yes, buy this cheap used car" can sort of work for both questions.

"How do I concatenate row values in T-SQL?" and "Is there a T-SQL function to concatenate strings?" is the same question, just worded differently.

2
  • 3
    I guess I got a little confused whit the question and all. "Does T-SQL have an aggregate function to concatenate strings?" seems to be a valid question, but in case of the OP it seems it was indeed a XY question and what he actually meant was "How do I concatenate row values in T-SQL?". Thankfully for me someone was kind enough to post how to solve that particular X problem using Y (which is exactly what I needed). I also seem to have understood wrong how duplicates work, so there really isn't that big of an issue even if something that isn't exactly a duplicate gets marked as one.
    – jahu
    Feb 24, 2015 at 13:38
  • I went to the duplicated question and the answer button seems to be missing, so I'm guessing if a question is marked as one it won;t be getting any more answers?
    – jahu
    Feb 26, 2015 at 14:34
1

I believe that it depends mostly on the extent to which the author indicates using Y is important to him/her.

So:

  • "I need to solve problem X and I need to do it with Y for reason Z. Can I do it with Y?" not a dupe (but it might be a dupe of "I need to solve problem X in condition Z")
  • "I am trying to use Y to solve problem X as an experiment/hobby/alternative to the obvious methods" not a dupe.
  • "I tried to solve problem X in several ways and nothing but Y seems to work. Can I do it?" typically a dupe (unless user has special circumstances)
  • "How can I solve X with Y?" typically a dupe (unless body of question suggests it's really one of the other cases)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .