Comma separated values in one column - SQL SERVER

前端 未结 4 1795
春和景丽
春和景丽 2020-12-06 11:12
Customer Table
--------------
ID   Name
1   James
2   Peter
Order Table
---------------
OrderId  CustId
100     1
101     1
102     2

How can I w

4条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-06 11:33

    A very simple and handy solution given on the link below.

    http://tejasnshah.wordpress.com/2009/02/28/sql-server-get-column-values-as-comma-seperated-list-using-xml-path-instead-of-udfs-using-sql-coalesce/

    The SQL query written on that link is in an image ...so i couldn't copy it here.

提交回复
热议问题