Share via


Query Operators

A query operator is used in a query clause when you create a work item query. Each query clause is composed of a field name, query operator, and value. The query operator determines which operation to apply when it determines whether a work item should be included in the results.

Query Operators

The following table lists the query operators available in Team Foundation work item tracking.

Query Operator Description Applicable Field Types

=

Returns a work item if the field matches the specified value.

Number, Text, Date, Tree

<>

Returns a work item if the field does not match the specified value.

Number, Text, Date, Tree

>

Returns a work item if the field is greater than the specified value.

Number, Text, Date

<

Returns a work item if the field is less than the specified value.

Number, Text, Date

>=

Returns a work item if the field is greater than or equal to the specified value.

Number, Text, Date

<=

Returns a work item if the field is less than or equal to the specified value.

Number, Text, Date

Contains

Returns a work item if the field contains the specified text value.

Text

Does Not Contain

Returns a work item if the field does not contain the specified text value.

Text

In

Returns a work item if the field matches any value in a specified set. For example, comparing the ID field to the set of values 100, 101, 102 will return work items 100, 101, and 102.

Number, Text, Date, Tree

Was Ever

Searches the history of the field. Returns the work item if any one of the historical field values match the specified value.

Text, Date

Under

Searches a tree field and returns any work items under the node specified by the value.

Tree

Not Under

Searches a tree field and returns any work items that are not under the node specified by the value.

Tree

Examples

The following table contains example query clauses that demonstrate some of the uses of the operators described previously.

Field Operator Value Description

Assigned To

Was Ever

@Me

Returns all work items that were ever assigned to you.

State

In

Triaged, In Progress

Returns all work items where the state is set to "Triaged" or "In Progress."

Area Path

Under

My Project\Setup Team

Returns all work items that belong to the "Setup Team" node and all nodes under the Setup Team node.

Title

Contains

Setup

Returns all work items with the word "Setup" in the title.

Created Date

>=

@Today - 7

Returns all work items created in the last week.

ID

=

100

Returns work item number 100.

See Also

Tasks

How to: Add New Work Item Queries

Concepts

Query Variables

Other Resources

Creating New Work Item Queries