「SQL」サブクエリにIN文を使用するサンプル
構文
select 項目名 from テーブル where 項目名 in (select 項目名 form テーブル where 条件式)
使用例
select
contactname
, address
, city
from
customers
where
contactname in (
select
contactname
from
customers
where
address like '%ser%'
)
結果
| ContactName | Address | City |
|---|---|---|
| Sven Ottlieb | Walserweg 21 | Aachen |