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

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

        <legend id='Ar1H4'><style id='Ar1H4'><dir id='Ar1H4'><q id='Ar1H4'></q></dir></style></legend>
      1. <tfoot id='Ar1H4'></tfoot>

        如何将多列组合为一并使用自定义字符串格式化?

        时间:2023-10-26
          • <bdo id='MUwSL'></bdo><ul id='MUwSL'></ul>

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

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

                    <tbody id='MUwSL'></tbody>

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

                  本文介绍了如何将多列组合为一并使用自定义字符串格式化?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  SELECT id, <X> AS name FROM `table`
                  

                  基本上
                  的组合姓氏 + ', ' + 名字

                  Basically <X> is a combination of
                  lastname + ', ' + firstname

                  例子是

                     id | name        |
                     2  | Smith, Bob  |
                     3  | Jones, Susy |
                  

                  这只是一个例子,我真的不想把名字组合得这么简单.

                  This is just an example, I don't really want to combine names so simple.

                  推荐答案

                  CONCAT() 函数?

                  SELECT id, CONCAT(lastname, ', ', firstname) AS name FROM `table`;
                  

                  如果要连接多个字段,还可以考虑 CONCAT_WS() 函数,其中第一个参数是其余参数的分隔符,添加在要连接的字符串之间:

                  If you are going to concatenate many fields, you could also consider the CONCAT_WS() function, where the first argument is the separator for the rest of the arguments, which is added between the strings to be concatenated:

                  SELECT id, 
                         CONCAT_WS(',', field_1, field_2, field_3, field_4) list
                  FROM   `table`;
                  

                  这篇关于如何将多列组合为一并使用自定义字符串格式化?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:ORA-01843 不是有效月份 - 比较日期 下一篇:MySQL 计算多列上的不同值

                  相关文章

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

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

                    <tfoot id='MfmEu'></tfoot>

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