Have a Question?
Table of Contents
< All Topics
Print

SQL Expression for Today’s Samples

Q: “Is there a way to build an expression that queries all the samples entered today? I have tried many different syntax, but I can’t figure out how to put a variable as today’s date.”

A: In LIMS 4.x, you can use the following SQL expression to query samples that were added today:

Int(Sample.AddedDate) = Date()

In LIMS 5.x for SQL Server, use the following expression:

CAST(Sample.AddedDate AS DATE) =

CAST(GETDATE() AS DATE)

Use the SQL Expressions screen on the Setup menu to add the new SQL expression with an appropriate name such as “Samples Added Today”. To use the expression, simply select it from the list of SQL expressions on the SQL tab of the query controls.

Table of Contents