Hi,
I am trying to restrict my Input tool to only load the past two day from the Date column via a SQL query.
It is an Oracle Database stored on the Gallery, my current query scans the whole table but it is a large table causing performance issues for other functions so need to find the most efficient way.
Does anyone have a good query you have been using or perhaps a better way to load in last two days from a database than the SQL query in Input Tool?
Current Query looks like this:
Where [DATE] in (select t2.DATE from (select t1.DATE, rank() over (Order By t1.DATE Desc) As rank From (Select Distinct DATE from SOURCE(t1))t2 where t2.RANK<=2)
Thank you in advance!
@ehellblom
Searched on the internet and find something like below should be helpful.
where date_submitted >= cast(dateadd(day, -2, getdate()) as date)
and date_submitted < cast(getdate() as date)