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

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

      <bdo id='sgbhh'></bdo><ul id='sgbhh'></ul>
      <tfoot id='sgbhh'></tfoot>
        <legend id='sgbhh'><style id='sgbhh'><dir id='sgbhh'><q id='sgbhh'></q></dir></style></legend>
      1. MySQL可以替换多个字符吗?

        Can MySQL replace multiple characters?(MySQL可以替换多个字符吗?)

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

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

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

                    <tbody id='hRZ6L'></tbody>
                  本文介绍了MySQL可以替换多个字符吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  我正在尝试替换 MySQL 字段中的一堆字符.我知道 REPLACE 函数,但它一次只替换一个字符串.我在手册中看不到任何适当的函数.

                  I'm trying to replace a bunch of characters in a MySQL field. I know the REPLACE function but that only replaces one string at a time. I can't see any appropriate functions in the manual.

                  我可以一次替换或删除多个字符串吗?例如,我需要用破折号替换空格并删除其他标点符号.

                  Can I replace or delete multiple strings at once? For example I need to replace spaces with dashes and remove other punctuation.

                  推荐答案

                  您可以链接 REPLACE 函数:

                  You can chain REPLACE functions:

                  select replace(replace('hello world','world','earth'),'hello','hi')
                  

                  这将打印hi earth.

                  您甚至可以使用子查询来替换多个字符串!

                  You can even use subqueries to replace multiple strings!

                  select replace(london_english,'hello','hi') as warwickshire_english
                  from (
                      select replace('hello world','world','earth') as london_english
                  ) sub
                  

                  或者使用 JOIN 来替换它们:

                  Or use a JOIN to replace them:

                  select group_concat(newword separator ' ')
                  from (
                      select 'hello' as oldword
                      union all
                      select 'world'
                  ) orig
                  inner join (
                      select 'hello' as oldword, 'hi' as newword
                      union all
                      select 'world', 'earth'
                  ) trans on orig.oldword = trans.oldword
                  

                  我将使用常用表格表达式的翻译作为读者练习;)

                  I'll leave translation using common table expressions as an exercise for the reader ;)

                  这篇关于MySQL可以替换多个字符吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  ibtmp1是非压缩的innodb临时表的独立表空间,通过innodb_temp_data_file_path参数指定文件的路径,文件名和大小,默认配置为ibtmp1:12M:autoextend,也就是说在文件系统磁盘足够的情况下,这个文件大小是可以无限增长的。 为了避免ibtmp1文件无止境的暴涨导致
                  SQL query to group by day(按天分组的 SQL 查询)
                  What does SQL clause quot;GROUP BY 1quot; mean?(SQL 子句“GROUP BY 1是什么意思?意思是?)
                  MySQL groupwise MAX() returns unexpected results(MySQL groupwise MAX() 返回意外结果)
                  MySQL SELECT most frequent by group(MySQL SELECT 按组最频繁)
                  Include missing months in Group By query(在 Group By 查询中包含缺失的月份)
                • <tfoot id='6PSRf'></tfoot>
                    <bdo id='6PSRf'></bdo><ul id='6PSRf'></ul>

                      <small id='6PSRf'></small><noframes id='6PSRf'>

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

                          1. <legend id='6PSRf'><style id='6PSRf'><dir id='6PSRf'><q id='6PSRf'></q></dir></style></legend>
                              <tbody id='6PSRf'></tbody>