Oracle to Redshift trunc function

I am trying to transition from Oracle to redshift and got stuck with this function conversion. Can someone help me with this?:

Oracle:

RESOLVED_DATE BETWEEN DATE_TRUNC(TO_DATE('{RUN_DATE_YYYYMMDD}','YYYYMMDD'),'Y') AND TO_DATE('{RUN_DATE_YYYYMMDD}','YYYYMMDD')

RedShift: ?

I am trying to get date from start of the year to the query run date.

1 answer

  • answered 2017-10-11 10:52 Jon Scott

    You can use

    select ...
    where RESOLVED_DATE between date_trunc('year',current_timestamp) and current_timestamp;