28
17

More than 5 years have passed since last update.

同じテーブルを複数回Joinしたい場合

Last updated at Posted at 2016-06-27

以下のように書くことで、
同じテーブルを複数回JOINすることが可能です。


SELECT * FROM table
INNER JOIN join_table AS join1
ON table.id = join1.id
INNER JOIN join_table AS join2
ON table.another_id = join2.another_id

JOINするテーブルをASを用いて、それぞれユニークなものにしてやればいいわけですね。

28
17
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
28
17