Oracle date function for the previous month
I have the query below where the date is hard-coded. My objective is to remove the harcoded date; the query should pull the data for the previous month when it runs. select count(distinct switch_id) from xx_new.xx_cti_call_details@appsread.prd.com where dealer_name = 'XXXX' and TRUNC(CREATION_DATE) BETWEEN '01-AUG-2012' AND '31-AUG-2012' Should I use sysdate-15 function for that? Priti Getkewar Joshi Modifying Ben's query little bit, select count(distinct switch_id) from xx_new.xx_cti_call_details@appsread.prd.com where dealer_name = 'XXXX' and creation_date between add_months(trunc(sysdate,