<small id='XtnUX'></small><noframes id='XtnUX'>

    <legend id='XtnUX'><style id='XtnUX'><dir id='XtnUX'><q id='XtnUX'></q></dir></style></legend>
    <tfoot id='XtnUX'></tfoot>
    1. <i id='XtnUX'><tr id='XtnUX'><dt id='XtnUX'><q id='XtnUX'><span id='XtnUX'><b id='XtnUX'><form id='XtnUX'><ins id='XtnUX'></ins><ul id='XtnUX'></ul><sub id='XtnUX'></sub></form><legend id='XtnUX'></legend><bdo id='XtnUX'><pre id='XtnUX'><center id='XtnUX'></center></pre></bdo></b><th id='XtnUX'></th></span></q></dt></tr></i><div id='XtnUX'><tfoot id='XtnUX'></tfoot><dl id='XtnUX'><fieldset id='XtnUX'></fieldset></dl></div>
      • <bdo id='XtnUX'></bdo><ul id='XtnUX'></ul>
    2. 相当于 WM_CONCAT 函数的 SQL Server

      SQL Server equivalent of WM_CONCAT function(相当于 WM_CONCAT 函数的 SQL Server)

      <small id='LmZe9'></small><noframes id='LmZe9'>

      <i id='LmZe9'><tr id='LmZe9'><dt id='LmZe9'><q id='LmZe9'><span id='LmZe9'><b id='LmZe9'><form id='LmZe9'><ins id='LmZe9'></ins><ul id='LmZe9'></ul><sub id='LmZe9'></sub></form><legend id='LmZe9'></legend><bdo id='LmZe9'><pre id='LmZe9'><center id='LmZe9'></center></pre></bdo></b><th id='LmZe9'></th></span></q></dt></tr></i><div id='LmZe9'><tfoot id='LmZe9'></tfoot><dl id='LmZe9'><fieldset id='LmZe9'></fieldset></dl></div>
        • <bdo id='LmZe9'></bdo><ul id='LmZe9'></ul>

        • <legend id='LmZe9'><style id='LmZe9'><dir id='LmZe9'><q id='LmZe9'></q></dir></style></legend>

            <tbody id='LmZe9'></tbody>
            • <tfoot id='LmZe9'></tfoot>

                本文介绍了相当于 WM_CONCAT 函数的 SQL Server的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                可能的重复:
                将字段值连接到 SQL Server 中的字符串

                WM_CONCAT 的 SQL Server 等价物是什么?

                What is the SQL Server equivalent of WM_CONCAT?

                推荐答案

                您没有相应的功能,但您仍然可以模拟(使用 CROSS APPLYFORXML PATH('')).例如,

                You don't have an equivalent function for that, but you can still simulate (make useof CROSS APPLY and FOR XML PATH('')). example,

                USERID  ADDRESSLINE1
                ==========================
                1       First Street
                1       Second Street
                2       32th Street
                2       24th Street
                2       25th Street
                

                结果

                USERID  ADDRESSLIST
                ============================
                1       First Street, Second Street
                2       32th Street, 24th Street, 25th Street
                

                使用此查询:

                SELECT  a.UserID, 
                        SUBSTRING(d.Addresses,1, LEN(d.Addresses) - 1) AddressList
                FROM
                        (
                            SELECT DISTINCT UserID
                            FROM tableName
                        ) a
                        CROSS APPLY
                        (
                            SELECT [AddressLine1] + ', ' 
                            FROM tableName AS B 
                            WHERE A.UserID = B.UserID 
                            FOR XML PATH('')
                        ) D (Addresses) 
                

                这篇关于相当于 WM_CONCAT 函数的 SQL Server的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                Building a comma separated list?(建立一个逗号分隔的列表?)
                Errors in SQL Server while importing CSV file despite varchar(MAX) being used for each column(尽管每列都使用了 varchar(MAX),但在导入 CSV 文件时 SQL Server 中出现错误)
                How can I import an Excel file into SQL Server?(如何将 Excel 文件导入 SQL Server?)
                Export table to file with column headers (column names) using the bcp utility and SQL Server 2008(使用 bcp 实用程序和 SQL Server 2008 将表导出到带有列标题(列名称)的文件)
                Concat field value to string in SQL Server(将字段值连接到 SQL Server 中的字符串)
                SQL Server Bulk insert of CSV file with inconsistent quotes(SQL Server 批量插入带有不一致引号的 CSV 文件)
                  <tfoot id='Nl4iT'></tfoot>
                  <legend id='Nl4iT'><style id='Nl4iT'><dir id='Nl4iT'><q id='Nl4iT'></q></dir></style></legend>

                    <tbody id='Nl4iT'></tbody>

                    <small id='Nl4iT'></small><noframes id='Nl4iT'>

                      <i id='Nl4iT'><tr id='Nl4iT'><dt id='Nl4iT'><q id='Nl4iT'><span id='Nl4iT'><b id='Nl4iT'><form id='Nl4iT'><ins id='Nl4iT'></ins><ul id='Nl4iT'></ul><sub id='Nl4iT'></sub></form><legend id='Nl4iT'></legend><bdo id='Nl4iT'><pre id='Nl4iT'><center id='Nl4iT'></center></pre></bdo></b><th id='Nl4iT'></th></span></q></dt></tr></i><div id='Nl4iT'><tfoot id='Nl4iT'></tfoot><dl id='Nl4iT'><fieldset id='Nl4iT'></fieldset></dl></div>
                        • <bdo id='Nl4iT'></bdo><ul id='Nl4iT'></ul>