how to write datetime <= (minus some days) in teradata case statement

2.9k Views Asked by At

I have to write an sql query where I need to extract data for 30 days minus few days,

something like this, datetime <= -5 days

what is the best possible way I can write in teradata?

Thanks in advance:)

1

There are 1 best solutions below

2
dnoeth On BEST ANSWER

Exactly 5 days based on a timestamp, e.g. 2021-09-24 13:42 -> 2021-09-19 13:42

 where timestamp_column <= current_timestamp - interval '5' day

Full days starting at midnight:

 where timestamp_column <= current_date - 5