Database.query.where

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
package168-1710
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
package168-1733
Syntax Description
{collection: {'exists': condition}}
{collection: {'not exists': condition}}
Specifies a condition to test for the existence (not existence) of related object(s)
package168-next
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:

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.