No Results
Search Tips:
- Please consider misspellings
- Try different search keywords
Newer Version Available
Condition Expression Syntax (WHERE Clause)
The conditionExpression in the WHERE clause in a SOQL statement uses the following syntax:
1fieldExpression [ logicalOperator fieldExpression2 ... ]You can add multiple field expressions to a condition expression by using logical operators.
The condition expressions in SOQL SELECT statements appear in bold in these examples:
- SELECT Name FROM Account WHERE Name LIKE 'A%'
- SELECT Id FROM Contact WHERE Name LIKE 'A%' AND MailingState='California'
- SELECT Name FROM Account WHERE CreatedDate
> 2011-04-26T10:00:00-08:00
You can use date or datetime values, or date literals. The format for date and dateTime fields are different.
- SELECT Amount FROM Opportunity WHERE
CALENDAR_YEAR(CreatedDate) = 2011
For more information on date functions, such as CALENDAR_YEAR(), see Date Functions.
- You can use parentheses to define the order in which fieldExpressions are evaluated. For example, the following
expression is true if fieldExpression1 is true and either fieldExpression2 or fieldExpression3 are true:
1fieldExpression1 AND (fieldExpression2 OR fieldExpression3) - However, the following expression is true if either fieldExpression3 is true or both fieldExpression1 and fieldExpression2 are true.
1(fieldExpression1 AND fieldExpression2) OR fieldExpression3 - Client applications must specify parentheses when nesting operators. However, multiple operators of the same type do not need to be nested.
- Only the first 254 characters in a rich text area or long text area field are considered in fieldExpressions.