わかればいいや、DBスペシャリスト過去問解説

厳密な解説よりも「わかればいいや」とか「わかりやすい」を基準に解説していきます。

1992 views

こういうテーブルを結合して、左外部結合したいとき。

結合したい左側のテーブル

結合したい右側のテーブル

期待する結果

SQL

select 
project_images.project_image_id,
project_images.project_id,
project_images.list,
project_images.field_id,
project_images.name,
project_images.rank,
images.image_id,
images.filename,
images.item_id,
images.moved,
images.create_date

from project_images 
left outer join (select * from images where item_id=2955297) AS images
on project_images.project_image_id = images.project_image_id where project_images.project_id=502
order by project_images.rank asc

Page 10 of 14.

前のページ 次のページ



[添付ファイル]


お問い合わせ

プロフィール

すぺぺぺ

自己紹介

本サイトの作成者。
プログラムは趣味と勉強を兼ねて、のんびり本サイトを作っています。
フレームワークはdjango。
ChatGPTで自動プログラム作成に取り組み中。

サイト/ブログ

https://www.osumoi-stdio.com/novel/

ツイッター

@darkimpact0626