Have a Question?
Table of Contents
< All Topics
Print

Query Multiple Sample Batches

A user recently wrote:

“Is there a faster/easier way to query all the samples for [multiple batches]? First I tried to enter a SQL to select 2 sample batches:

(Sample.Batch = 50) AND (Sample.Batch = 51)

 But it wouldn’t work. Maybe my syntax is wrong.”

While the SQL expression above is syntactically correct, it is logically incorrect so the query did not find any samples. The expression attempts to find all samples where the sample’s batch number is both 50 and 51.

Since a sample can only have one batch number the query fails to find any samples. Simply changing “AND” in the expression to “OR” solves the problem by finding all samples where the sample’s batch number is either 50 or 51.

However, for an easier method to query multiple sample batches, simply enter an expression directly in the Batch field on the Additional tab of the query controls. For example, to query samples with consecutive batch numbers use: Between 50 and 51 To query samples for any number of batches, enter a comma-separated list of batch numbers with this expression:

In (50, 51, 55)

To view examples of other batch querying options, hover the mouse over the Batch field on the Additional tab of the query controls.

Table of Contents