Syntax
query.where(condition)
query.where(sqlCondition[, params])
Description
Creates a Database.query enumerating all the objects fitting the criteria.
Operators
Syntax | Description |
---|---|
{field: value} | equal to |
Syntax | Description |
---|---|
{field: {'=': value}} {field: {'==': value}} {field: {'<>': value}} {field: {'!=': value}} |
[not] equal to |
{field: {'>': value}} {field: {'>=': value}} |
greater than [or equal to] |
{field: {'<': value}} {field: {'<=': value}} |
less than [or equal to] |
{field: {'between': [fromValue, toValue]}} {field: {'not between': [fromValue, toValue]}} |
[not] between |
{field: {'like': value}} {field: {'not like': value}} |
[not] like |
{field: {'in': [value1, value2, ...]}} {field: {'not in': [value1, value2, ...]}} |
[not] in |
{and: [condition1, condition2, ...]} {'&&': [condition1, condition2, ...]} |
and |
{or: [condition1, condition2, ...]} {'||': [condition1, condition2, ...]} |
or |
Syntax | Description |
---|---|
{collection: {'exists': condition}} {collection: {'not exists': condition}} |
Specifies a condition to test for the existence (not existence) of related object(s) |
Syntax | Description |
---|---|
{not: condition} | not |
Examples
See also Database.query examples.
Comparison operators
All charges of a specific job with Total Cost greater than 50.00
Logical operators
The snippet above is equivalent to:
or with multiple where clauses:
Using or and like operators:
Using fields in condition on right:
Using references
select jobs that have CSR Employee with Login_Id equals 'Administrator':
select jobs that have CSR Employee the same as Sales Employee:
Using exists with collections
select projects that have Jobs with Job Number equals 10 and not have Jobs with Job Number equals 20: