SQL SERVER Concat Multiple columns with Group by and comma seperated in SQL RRS feed

  • דיון כללי

  • Hi Gurus,

    I have a requirements where I need to concatenate multiple columns with comma separated using group by.

    Agmts             QTR1     QTR2     QTR3   QTR 4    QTR5

    111                  N                          

    111                                  W                                                      


    131                   N                          E                            

    141                   E              N          W        SE      S                         

    I need output like this

    Agmts       Concat

    111          N,W


    131           N,E

    141           E,N,W,SE,S

    I am using Sql server 2014. Any help would be greatly appreciated.




    • נערך על-ידי Naveen Bhogaraju יום חמישי 21 ינואר 2021 19:52
    • שינה את הסוג Naveen Bhogaraju יום חמישי 21 ינואר 2021 20:39
    יום חמישי 21 ינואר 2021 19:43

כל התגובות

  • Welcome to the MSDN Hebrew Data Platform forums

    This forum is for discussion in Hebrew. 

    There is a different forum for English of you need.

    Can we answer your question in Hebrew?

    In any case, in order to help you we need to reproduce the scenario. Please provide queries to create your table and to insert sample data. In addition please describe the expected result according to the sample data

    Thanks and welcome to the forum

    signature   Ronen Ariely
     [Personal Site]    [Blog]    [Facebook]    [Linkedin]

    יום רביעי 10 פברואר 2021 02:42
    מנחה דיון