SOQL Where Clause
WHERE clause is used to filter records that match a certain condition. For example, you could use the following query to return every account with the billing country equal to France:
We can also combine multiple logical tests in our
WHERE clause using
OR. If, for example, in our previous query, we only wanted to return the accounts with billing country equal to France that also had a billing city equal to ‘Paris’, we could use
AND to specify both conditions.
The following table show how to filter rows depending on field data type:
|A string value is enclosed in single quotes|
|A number value is written directly|
|A boolean value is written as either true/false|
|A date is written in this format (yyyy-mm-dd)|
|A datetime is written in this format (yyyy-mm-ddThh:mm:ssZ)|
Note that a value can also be a date literal like (appointment_date__c = TODAY) which we will explain later.