<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

      时间:2023-10-09

      <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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:MSSQL 2008 R2 中没有聚合函数的枢轴 下一篇:尝试从 Select 创建表 - SQL Server 2008 抛出错误

                相关文章

                  <tfoot id='Nl4iT'></tfoot>
                  <legend id='Nl4iT'><style id='Nl4iT'><dir id='Nl4iT'><q id='Nl4iT'></q></dir></style></legend>

                  <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>