1
0

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 3 years have passed since last update.

【Salesforce】SOQLのIN句に変数を設定する

Last updated at Posted at 2022-02-15

IN句に変数を使用せずに複数条件を設定

Apex
List<User> userIdList = [SELECT Id FROM User WHERE UserName IN ('taro@test.com', 'jiro@test.com')];

IN句に変数を使用して複数条件を設定

リストを扱えるクラスを使用しIN句に複数条件を設定できます。

Apex
Set<String> userList = new Set<String>();
userList.add('taro@test.com');
userList.add('jiro@test.com');

List<User> userIdList = [SELECT Id FROM User WHERE Name IN :userList];
1
0
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
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?