6
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

多対多テーブルでMySQLでLEFT JOINして中身確認の備忘録

Last updated at Posted at 2014-03-09

ちょっと長いけどこんな感じです

videos基準
select videos.id, videos.title, tags.id, tags.name from videos left join tags_videos on videos.id=tags_videos.video_id left join tags on tags_videos.tag_id=tags.id;

tags基準
select videos.id, videos.title, tags.id, tags.name from tags left join tags_videos on tags.id=tags_videos.tag_id left join videos on tags_videos.video_id=videos.id;

6
6
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
6
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?