こんにちは、INNER JOIN のカップルでクエリを実行しようとしています。どこが悪いのですか?
job_tbl.id、accounts.username AS starter、accounts.username AS worker、job_tbl.comment、job_tbl.date、job_tbl.status を選択
FROM job_tbl
INNER JOIN accounts ON job_tbl.starter = accounts.id
内部結合 accounts ON job_tbl.worker = accounts.id
ここのjob_tblテーブル:
+----+---------+--------+---------+------+--------+
| id | starter | worker | comment | date | status |
+----+---------+--------+---------+------+--------+
| 1 | 1 | 3 | qwe | date | 10 |
+----+---------+--------+---------+------+--------+
| 2 | 2 | 1 | qwe | date | 10 |
+----+---------+--------+---------+------+--------+
ここにアカウントテーブルがあります:
+----+------------+-----------+-------+
| id | username | extension | email |
+----+------------+-----------+-------+
| 1 | Julia | 100 | email |
+----+------------+-----------+-------+
| 2 | Eve | 101 | email |
+----+------------+-----------+-------+
| 3 | Max | 102 | email |
+----+------------+-----------+-------+
私はそれが欲しい:
+----+---------+--------+---------+------+--------+
| id | starter | worker | comment | date | status |
+----+---------+--------+---------+------+--------+
| 1 | Julia | Max | qwe | date | 10 |
+----+---------+--------+---------+------+--------+
| 2 | Eve | Julia | qwe | date | 10 |
+----+---------+--------+---------+------+--------+