0
重複第i列有兩個表:如何加入表,而不用在MySQL
表1(限5):
+--------------+
| TF_ID |
+--------------+
| T139297_1.02 |
| T025433_1.02 |
| T025429_1.02 |
| T045327_1.02 |
| T088966_1.02 |
+--------------+
表2(限5):
+--------------+-----------+------------+-------------+
| TF_ID | Family_ID | TSource_ID | DBID |
| T000001_1.02 | F001_1.02 | TS19_1.02 | FBgn0085089 |
| T000002_1.02 | F002_1.02 | TS07_1.02 | AMAG_03406 |
| T000003_1.02 | F002_1.02 | TS07_1.02 | AMAG_05299 |
| T000004_1.02 | F002_1.02 | TS07_1.02 | AMAG_10904 |
| T000005_1.02 | F002_1.02 | TS07_1.02 | AMAG_15258 |
+--------------+-----------+------------+-------------+
我想加入兩個表TF_ID列,我試過這個:
select a.TF_ID, b.TF_ID, b.Family_ID from table1 a, table2 b where a.TF_ID=b.TF_ID;
輸出是這樣的:
+--------------+--------------+-----------+
| TF_ID | TF_ID | Family_ID |
+--------------+--------------+-----------+
| T014411_1.02 | T014411_1.02 | F070_1.02 |
| T014431_1.02 | T014431_1.02 | F070_1.02 |
| T014439_1.02 | T014439_1.02 | F070_1.02 |
| T014447_1.02 | T014447_1.02 | F070_1.02 |
| T014450_1.02 | T014450_1.02 | F070_1.02 |
我應該怎麼做,如果我沒有什麼TF_ID科拉姆重複? i新生數據庫,請幫助
只是不要列出兩次。您不必在列列表中包含它兩次。 –
您手動選擇該列,只需從查詢中移除它,如'select a.TF_ID,b.Family_ID from table1 a,table2 b where a.TF_ID = b.TF_ID; ' –