私はMySQLで1つのプロジェクトを行っています。に 1 つの問題がありjoin
ます。
+---+-----------+-----------+
|id | name | elective |
+---+-----------+-----------+
| 1 | Jone | Math |
| 2 | Jane | Math |
| 3 | Doe | Math |
| 4 | Bloggs | Math |
| 5 | Peter | Math |
| 6 | Chris | Math |
| 7 | Mark | Math |
| 3 | Doe | Physics |
| 4 | Bloggs | Physics |
| 5 | Peter | Physics |
| 6 | Chris | Physics |
| 7 | Mark | Physics |
| 5 | Peter | Chemistry |
| 6 | Chris | Chemistry |
| 7 | Mark | Chemistry |
+---+-----------+-----------+
上の表では、2 つ以上の科目を選択した人はほとんどおらず、2 つの科目だけを選択した人はほとんどいません。また、1 つの主題のみを選択した人もいます。
しかし、私は2番目のもの、つまり2つの科目のみを取得した人のみを表示したい. これは、内部結合を使用して取得したいです。