1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

  2. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[SQL] How can i use stuff function for multiple columns in SQL server?

Discussão em 'Outras Linguagens' iniciado por Stack, Setembro 1, 2021.

  1. Stack

    Stack Membro Participativo

    I have a requirement for concatenating two values of two rows having same Id's and averaging for other column. Here is the sample table I have:

    [​IMG]

    Now my requirement is I need to concatenate the Response column, concatenate Response Rating column and average the Rating Avg column if it has same ParticipantId, UseriD, QuestionId and ConductedById.

    Here is the target data what I wanted:

    [​IMG]

    Here Response column and Response rating column is concatenated with respective rows and Rating Avg column is taken the average. I have done one column concatenation previously using stuff function. Can this be achieved using stuff function?

    Continue reading...

Compartilhe esta Página