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

Time:09-25

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:)

CodePudding user response:

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
  • Related