<legend id='PSUtU'><style id='PSUtU'><dir id='PSUtU'><q id='PSUtU'></q></dir></style></legend>
  • <small id='PSUtU'></small><noframes id='PSUtU'>

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

        使用 select 向查询结果添加行

        时间:2023-10-08
      2. <legend id='VyxY6'><style id='VyxY6'><dir id='VyxY6'><q id='VyxY6'></q></dir></style></legend>

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

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

        <tfoot id='VyxY6'></tfoot>

                <tbody id='VyxY6'></tbody>

                <bdo id='VyxY6'></bdo><ul id='VyxY6'></ul>
                  本文介绍了使用 select 向查询结果添加行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  是否可以使用这样的文字扩展查询结果?

                  Is it possible to extend query results with literals like this?

                  select name from users
                  union
                  select name from ('JASON');
                  

                  select age, name from users
                  union
                  select age, name from (25,'Betty');
                  

                  所以它返回表中的所有名字加上'JASON',或(25,'Betty').

                  so it returns all the names in the table plus 'JASON', or (25,'Betty').

                  推荐答案

                  你可以这样使用:

                  SELECT  age, name
                  FROM    users
                  UNION
                  SELECT  25 AS age, 'Betty' AS name
                  

                  使用 UNION ALL 允许重复:如果您的用户中有 25 岁的 Betty,则第二个查询将不会仅使用 UNION 再次选择她.

                  Use UNION ALL to allow duplicates: if there is a 25-years old Betty among your users, the second query will not select her again with mere UNION.

                  这篇关于使用 select 向查询结果添加行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:MySQL 性能优化:按日期时间字段排序 下一篇:从mysql表中选择特定行

                  相关文章

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

                        <bdo id='ShSZz'></bdo><ul id='ShSZz'></ul>
                    1. <tfoot id='ShSZz'></tfoot><legend id='ShSZz'><style id='ShSZz'><dir id='ShSZz'><q id='ShSZz'></q></dir></style></legend>

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