SOQL IN Operator

SOQL IN Operator : In our previous Salesforce tutorial we have learned about comparison operators in SOQL. In this salesforce Training Tutorial we are going to learn about IN Operator.

SOQL IN Operator

In Salesforce Object Query Language IN Operator is used to specify multiple values in the WHERE clause for matching and filtering records.

When We use IN operator in SOQL the data is fetched from the matched values specified in the SOQL statement.

let us see an example on SOQL IN Operator.

  • SELECT Firstname, Lastname FROM Contact WHERE Firstname IN ( ‘Rose’, ‘Sean’ )
SOQL IN Operator

SOQL IN Operator

Data is retrieved from the records whose first name is Rose and Sean. Values inside the braces are case insensitive.

SOQL NOT IN Operator

SOQL NOT IN operator is used to specify multiple values in the WHERE clause for unmatching and filtering records. This operator is used to fetch data which are not matched with the values specified in the statement.

  • SELECT firstname, lastname FROM Contact WHERE firstname NOT IN ( ‘Rose’, ‘Sean’ )
SOQL IN Operator

SOQL IN Operator

In this example we have used NOT IN Operator by using this operator the data is fetched other than Rose and Sean from contacts.

Comments on this entry are closed.

error: Content is protected !!