Oralce in文を使用して複数の値を条件にするサンプル
環境
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0
SQL*Plus: Release 12.2.0.1.0
構文
select * from テーブル名
where 項目名 in (値1,値2,・・・)
使用例
userテーブル
userid username age
10 userA 32
22 userB 41
33 userC 44
userid username age
10 userA 32
22 userB 41
33 userC 44
userid username age 10 userA 32 22 userB 41 33 userC 44
in文を使用し値を複数指定します。
項目「userid」に22または33がある行を抽出します。
SQL構文
select * from user
where userid in ('22','33');
select * from user
where userid in ('22','33');
select * from user where userid in ('22','33');