SOQL Logical Operators | AND, OR

SOQL Logical Operators : In our previous salesforce Tutorial we have learned about SOQL IN Operators. In this Salesforce Training we are going to learn about SOQL logical operators called “AND”, “OR”. We learn clearly about SOQL Logical operators with an example .

What is a SOQL Logical Operator ?

SOQL Logic Operators are the connectors for connecting one or more conditions in a Single SOQL statement. These SOQL logical operators are very easy to use to check multiple conditions in a single Salesforce Object Query language statement.

There are two types of SOQL Logical operators in salesforce.com. They are

  1. Operator AND.
  2. Operator OR.

SOQL Logical Operator AND

Logical Operator “AND” is used to retrieve the records when all the conditions in SOQL statement is satisfied. If any  of the condition in SOQL statement is not satisfied records will not be retrieved.

  • SELECT name, Amount FROM opportunity WHERE Amount > 1000 AND Amount < 10000

soql logical opertors

SOQL Logical Operator OR

Logical operator OR is used to retrieve the data if any of the condition in SOQL statement is satisfied. SOQL logical operator “OR” matches the first condition with second condition and data will be retrieved.

soql logical opertors1

SELECT name, Amount FROM opportunity WHERE name = ‘express logistics‘  OR name = ‘GenePoint SLA’

Comments on this entry are closed.

error: Content is protected !!