Oracle date function for the previous month

后端 未结 6 2106
醉梦人生
醉梦人生 2021-02-18 17:25

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.

<         


        
6条回答
  •  抹茶落季
    2021-02-18 18:01

    It is working with me in Oracle sql developer

        SELECT add_months(trunc(sysdate,'mm'), -1),
               last_day(add_months(trunc(sysdate,'mm'), -1)) 
        FROM dual
    

提交回复
热议问题