<legend id='dpGvS'><style id='dpGvS'><dir id='dpGvS'><q id='dpGvS'></q></dir></style></legend>

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

    <tfoot id='dpGvS'></tfoot>

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

      <bdo id='dpGvS'></bdo><ul id='dpGvS'></ul>

      1. 如何在 SQL Server 2005 中将多行组合成逗号分隔的列表?

        时间:2023-09-18
        <i id='bawaj'><tr id='bawaj'><dt id='bawaj'><q id='bawaj'><span id='bawaj'><b id='bawaj'><form id='bawaj'><ins id='bawaj'></ins><ul id='bawaj'></ul><sub id='bawaj'></sub></form><legend id='bawaj'></legend><bdo id='bawaj'><pre id='bawaj'><center id='bawaj'></center></pre></bdo></b><th id='bawaj'></th></span></q></dt></tr></i><div id='bawaj'><tfoot id='bawaj'></tfoot><dl id='bawaj'><fieldset id='bawaj'></fieldset></dl></div>
        <tfoot id='bawaj'></tfoot>

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

            • <bdo id='bawaj'></bdo><ul id='bawaj'></ul>

                <tbody id='bawaj'></tbody>
                <legend id='bawaj'><style id='bawaj'><dir id='bawaj'><q id='bawaj'></q></dir></style></legend>
                • 本文介绍了如何在 SQL Server 2005 中将多行组合成逗号分隔的列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  现在,我有一个这样的 SQL 查询:

                  Right now, I have a SQL Query like this one:

                  SELECT X, Y FROM POINTS
                  

                  它返回这样的结果:

                  X    Y
                  ----------
                  12   3
                  15   2
                  18   12
                  20   29
                  

                  我想在一行中返回结果,就像这样(适合在 HTML 标签中使用):

                  I'd like to return results all in one row, like this (suitable for using in an HTML <AREA> tag):

                  XYLIST
                  ----------
                  12,3,15,2,18,12,20,29
                  

                  有没有办法只使用 SQL 来做到这一点?

                  Is there a way to do this using just SQL?

                  推荐答案

                  DECLARE @XYList varchar(MAX)
                  SET @XYList = ''
                  
                  SELECT @XYList = @XYList + CONVERT(varchar, X) + ',' + CONVERT(varchar, Y) + ','
                  FROM POINTS
                  
                  -- Remove last comma
                  SELECT LEFT(@XYList, LEN(@XYList) - 1)
                  

                  这篇关于如何在 SQL Server 2005 中将多行组合成逗号分隔的列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:在 Kubernetes 上创建时如何初始化 mysql 容器? 下一篇:sql server 函数中的 newid()

                  相关文章

                • <legend id='0FTPT'><style id='0FTPT'><dir id='0FTPT'><q id='0FTPT'></q></dir></style></legend>

                      • <bdo id='0FTPT'></bdo><ul id='0FTPT'></ul>

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

                      <small id='0FTPT'></small><noframes id='0FTPT'>