5

Question : Selecting data from multiple rows and insert it into a column.

@LenHart posted an answer

Someone else tried to add to his answer with this edit

Edit: The T-SQL (SQL Server) syntax uses CROSS APPLY to perform the same task, i.e.:

    SELECT x.name, y.address
    FROM temp x 
    CROSS APPLY ( VALUES (x.name, x.city),
                         (x.name, x.phone_no),
                         (x.name, x.pincode)) AS y(name, address) 

CROSS APPLY in SQL Server also often generates more effective execution plans than a bunch of union operators, so it's definitely worth a try.

I had rejected it with the reason Should be posted as a separate answer.

Would it be worth it to add this as a standard reason for rejecting edits ?

6

No. This was a good edit suggestion. Having multiple answers that address part of the question is not preferable to having one good, collaboratively-improved answer. This is a wiki site, after all.

7

I have to disagree with the currently accepted answer.
This is a Wiki site, but there is more than one possible, valid answer for most of the more complex questions. It helps to keep different answers from multiple authors separate:

  • To see when each was posted easily, without having to study the edit history.

  • To have separate votes on multiple alternatives, so we can see which solution is more popular (taking the date of the post into account).

  • In extreme cases to flag / close / delete just that answer.

  • To attribute each answer to a specific author. Regulars - most probably including you (the reader) - learn to interpret answers better, knowing the background of the author a bit.
    For instance, I can understand why somebody choses a certain syntax variant, given that 90% of his answers are for RDBMS XY.

If all parties agree on a single, cooperative answer, that's perfectly fine, of course. We would see comments indicating as much ...

You must log in to answer this question.

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