This course is currently a work in progress. Please join the waitlist to receive regular updates.

AND Operator in SOQL

AND or operator is used to filter records from an SOQL query results. The AND operator is used to find records that match all filter conditions.

Using AND clause in SOQL

Following is an example of using AND clause in SOQL to find the cases where origin is 'Email' and status is 'New'.

Loading...

In the above example:

  • The query statement starts with a SELECT keyword, followed by a set of comma-separated fields (e.g. id, caseNumber) that you want to query from an object.
  • The FROM keyword specifies the object (e.g., Case) from which data is queried in Salesforce.
  • The records are filtered using the WHERE condition, with filters applied to fields like Origin and Status.
  • The AND keyword is used to filter case records where the Origin is Email and the Status is New.

Try It Yourself

Loading...