'main_soko = メイン倉庫 / sub_soko = サブ倉庫 の比較 'select文の「mein_soko」を「x」にinする 'where文で条件設定 'andで更に複合キーの検索の場合、existsを使用し、 ' exists (select * from 文で更に条件式を追加 'これで二つのテーブルの条件が一致したデータを抽出する事が出来ます。 '(exists = 複数キーのテーブルに対してExists句を利用する場合には確実に '存在する事が解っている項目をサブクエリの抽出列に設定する必要があります) select * from mein_soko x where substr(mein_no,1,1) = 'A' and exists (select * from sub_soko _ where sub_no = x.mein_no and kekka = x.kekka)