Bisher habe ich das.mehrere Joins auf gleichen Tabellen
SELECT p1.player_id, p1.real_name, p2.player_id, p2.real_name,
-> m.scoreA, m.scoreB
-> FROM matches m
-> JOIN players p1 ON p1.player_id = m.playerA
-> JOIN players p2 ON p2.player_id = m.playerB;
+-----------+------------------------------------+-----------+------------------------------------+--------+--------+
| player_id | real_name | player_id | real_name | scoreA | scoreB |
+-----------+------------------------------------+-----------+------------------------------------+--------+--------+
| 19 | Seong Hun Choi | 1 | Dong Nyoung Lee | 0 | 2 |
| 38 | Yun Sik Choi | 1 | Dong Nyoung Lee | 0 | 2 |
| 160 | Lei Wang | 1 | Dong Nyoung Lee | 0 | 2 |
| 3 | Seung Hyun Lee | 1 | Dong Nyoung Lee | 0 | 2 |
| 45 | Min Chul Kim | 1 | Dong Nyoung Lee | 0 | 2 |
| 23 | Sasha Hostyn | 1 | Dong Nyoung Lee | 2 | 4 |
| 52 | Juan Moreno Duran | 1 | Dong Nyoung Lee | 2 | 3 |
| 18 | Kang Dong Hyun | 1 | Dong Nyoung Lee | 2 | 1 |
| 22 | Jae Duck Lim | 1 | Dong Nyoung Lee | 1 | 2 |
| 108 | Jérémy Vansnick | 1 | Dong Nyoung Lee | 1 | 2 |
Ich möchte ein paar mehr Spalten von meinem members
Tisch setzen, ohne table
die Größe meiner Matches zu ändern. Alles, was ich versuche, scheint die Größe meiner Treffertabelle zu ändern. Es geht von 46k auf über 1 Million. Das habe ich bisher versucht.
Ich dachte, vielleicht habe ich den gleichen Teil falsch eingestellt, also habe ich das versucht.
SELECT p1.player_id, p1.real_name, p2.player_id, p2.real_name,
m.scoreA, m.scoreB, mem1.player, mem2.player
FROM matches m
JOIN players p1 ON p1.player_id = m.playerA
JOIN members mem1 ON mem1.player = m.playerA
JOIN players p2 ON p2.player_id = m.playerB
JOIN members mem2 ON mem2.player = m.playerB;
Ich möchte es so aussehen, wenn es fertig ist.
+-----------+------------------------------------+-----------+------------------------------------+--------+--------+
| player_id | real_name | player_id | real_name | scoreA | scoreB | member1 member2
+-----------+------------------------------------+-----------+------------------------------------+--------+--------+
| 19 | Seong Hun Choi | 1 | Dong Nyoung Lee | 0 | 2 |
| 38 | Yun Sik Choi | 1 | Dong Nyoung Lee | 0 | 2 |
| 160 | Lei Wang | 1 | Dong Nyoung Lee | 0 | 2 |
| 3 | Seung Hyun Lee | 1 | Dong Nyoung Lee | 0 | 2 |
| 45 | Min Chul Kim | 1 | Dong Nyoung Lee | 0 | 2 |
| 23 | Sasha Hostyn | 1 | Dong Nyoung Lee | 2 | 4 |
| 52 | Juan Moreno Duran | 1 | Dong Nyoung Lee | 2 | 3 |
| 18 | Kang Dong Hyun | 1 | Dong Nyoung Lee | 2 | 1 |
| 22 | Jae Duck Lim | 1 | Dong Nyoung Lee | 1 | 2 |
| 108 | Jérémy Vansnick | 1 | Dong Nyoung Lee | 1 | 2 |
| 53 | Igor Turchin | 1 | Dong Nyoung Lee | 1 | 2 |
| 17 | Hyun Woo Park | 1 | Dong Nyoung Lee | 0 | 2 |
Ich brauche diesen Prozess auch mit zwei weiteren Tabellen zu wiederholen, so hilft mir das Verfahren von zu verstehen, wie dies zu tun wäre sehr geschätzt.
Übereinstimmungsliste.
+----------+------------+------------+---------+---------+--------+--------+---------+
| match_id | date | tournament | playerA | playerB | scoreA | scoreB | offline |
+----------+------------+------------+---------+---------+--------+--------+---------+
| 1 | 2012-12-04 | 799 | 4 | 55 | 1 | 3 | 0 |
| 2 | 2012-12-03 | 11921 | 2 | 41 | 2 | 0 | 0 |
| 3 | 2012-12-03 | 11921 | 21 | 41 | 0 | 2 | 0 |
| 4 | 2012-12-03 | 11921 | 3 | 2 | 2 | 1 | 0 |
| 5 | 2012-12-03 | 11921 | 41 | 2 | 1 | 2 | 0 |
| 6 | 2012-12-03 | 11921 | 21 | 3 | 1 | 2 | 0 |
| 7 | 2012-12-03 | 11924 | 1 | 8 | 2 | 1 | 1 |
| 8 | 2012-12-03 | 11924 | 1 | 8 | 2 | 3 | 1 |
| 9 | 2012-12-03 | 11924 | 8 | 19 | 3 | 2 | 1 |
| 10 | 2012-12-03 | 11924 | 19 | 12 | 2 | 1 | 1 |
+----------+------------+------------+---------+---------+--------+--------+---------+
Spieler Tabelle
+-----------+-----------+-----------------+-------------+------------+-----------+
| player_id | tag | real_name | nationality | birthday | game_race |
+-----------+-----------+-----------------+-------------+------------+-----------+
| 1 | Leenock | Dong Nyoung Lee | KR | 1995-04-01 | Z |
| 2 | Creator | Hyun Woo Jang | KR | 1996-08-19 | P |
| 3 | Life | Seung Hyun Lee | KR | 1997-01-11 | Z |
| 4 | DongRaeGu | Soo Ho Park | KR | 1991-06-03 | Z |
| 5 | PartinG | Lee Sak Won | KR | 1994-08-24 | P |
| 6 | TaeJa | Young Suh Yoon | KR | 1995-01-01 | T |
| 7 | Rain | Yoon Jong Jung | KR | 1992-08-14 | P |
| 8 | viOLet | Dong Hwan Kim | KR | 1990-12-05 | Z |
| 9 | Sniper | Tae Hoon Kwon | KR | 1995-01-22 | Z |
| 10 | Stephano | Ilyes Satouri | FR | 1993-03-12 | Z |
+-----------+-----------+-----------------+-------------+------------+-----------+
Mitglieder Tisch
+--------+------+------------+------------+
| player | team | start_date | end_date |
+--------+------+------------+------------+
| 1 | 88 | 2011-02-23 | 2011-07-18 |
| 1 | 4 | 2011-07-18 | NULL |
| 2 | 3 | 2011-01-12 | NULL |
| 3 | 65 | 2010-10-19 | 2012-07-13 |
| 3 | 1 | 2012-07-13 | NULL |
| 4 | 7 | 2011-02-20 | NULL |
| 5 | 88 | 2010-10-29 | 2011-07-18 |
| 5 | 1 | 2012-10-21 | 2013-01-03 |
| 5 | 12 | 2013-01-14 | NULL |
| 6 | 65 | 2011-03-01 | 2011-05-01 |
+--------+------+------------+------------+
Können Sie das Schema hier schreiben? – MASh
Zeigen Sie nicht die Ergebnisse von Abfragen mit mehreren Tabellen an, sondern zeigen Sie uns einige Daten aus jeder Tabelle an. einschließlich der DDL jeder Tabelle würde auch helfen. –
Ist das was du meinst? 'player_id | echter_name | Spieler_ID | echter_name | scoreA | scoreB | member1 member2' Es tut mir leid, ich weiß nicht, was Sie mit dem Schema meinen. – noobprogrammer1987