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

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

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

        MySQL - 从具有相同结构但不同数据的多个表中选择数据

        时间:2023-05-24

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

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

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

              • <bdo id='zBFxJ'></bdo><ul id='zBFxJ'></ul>
                <tfoot id='zBFxJ'></tfoot>
                  <tbody id='zBFxJ'></tbody>

                  本文介绍了MySQL - 从具有相同结构但不同数据的多个表中选择数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  好的,这是我的困境我有一个数据库,其中设置了大约 5 个表,所有表都具有完全相同的数据结构.以这种方式分离数据是为了本地化目的,并拆分总共约 450 万条记录.

                  Ok, here is my dilemma I have a database set up with about 5 tables all with the exact same data structure. The data is separated in this manner for localization purposes and to split up a total of about 4.5 million records.

                  大多数时候只需要一张桌子,一切都很好.但是,有时需要来自 2 个或更多表的数据,并且需要按用户定义的列对其进行排序.这就是我遇到问题的地方.

                  A majority of the time only one table is needed and all is well. However, sometimes data is needed from 2 or more of the tables and it needs to be sorted by a user defined column. This is where I am having problems.

                  数据列:

                  id, band_name, song_name, album_name, genre
                  

                  MySQL 语句:

                  SELECT * from us_music, de_music where `genre` = 'punk'
                  

                  MySQL 吐出这个错误:

                  MySQL spits out this error:

                  #1052 - Column 'genre' in where clause is ambiguous
                  

                  显然,我做错了.有人愿意为我解释一下吗?

                  Obviously, I am doing this wrong. Anyone care to shed some light on this for me?

                  推荐答案

                  我认为您正在寻找 UNION 子句,一拉

                  I think you're looking for the UNION clause, a la

                  (SELECT * from us_music where `genre` = 'punk')
                  UNION
                  (SELECT * from de_music where `genre` = 'punk')
                  

                  这篇关于MySQL - 从具有相同结构但不同数据的多个表中选择数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:MySQL:如果列不存在则更改表 下一篇:使用 LOAD DATA INFILE 导入 MySQL 表时如何跳过 CSV 文件中的列?

                  相关文章

                1. <small id='C0P3H'></small><noframes id='C0P3H'>

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

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

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