Hi,
I have below query to return records that are created in the current month and data is created in last 14 days ( 'mm' and 'yyyy' check is to ignore last month data if the query runs on first week or early 2nd week of the month).
Is there a way to tune below query to replace TO_CHAR function to get data for the current month with less than 14 days.
select * from Table_1
where source_col ='BIT'
and create_dts > sysdate -14
and TO_CHAR(create_dts, 'mm') = TO_CHAR(SYSDATE, 'mm')
and TO_CHAR(create_dts, 'yyyy') = TO_CHAR(SYSDATE, 'yyyy');
Thanks!