General Discussions

Discuss any topics that are not product-specific here.
SOLVED

Date issue

BBaes
5 - Atom

I am connecting to a data base and want the Data pull to always start on the previous Monday. The expression is called return_date and I cant get any criteria to work. Any suggestions? 

1 REPLY 1
jamielaird
14 - Magnetar

Hi @BBaes 

 

In Microsoft SQL Server, you could use the following query to select all records from a table from the previous Monday onwards.

 

select *
from my_table
where my_date >= dateadd(week,datediff(week,0,getdate()),0);

 

The exact syntax will depend on the type of database you are using.

 

I've created an example in SQL Fiddle that you can use to explore the query or adapt it for a different flavour of SQL.

 

http://sqlfiddle.com/#!18/39c01/6

 

jamielaird_1-1614852411442.png

 

 

Labels