Home » SQL & PL/SQL » SQL & PL/SQL » How to select previous month's data
How to select previous month's data [message #732] Thu, 28 February 2002 10:41 Go to next message
Bharat Mehta
Messages: 4
Registered: February 2002
Junior Member
How to select data for previous whole month.

I need to select data for previous whole month. For ex.
anytime in Feb/2002, I would like to select 01-Jan-2002 to 31-Jan-2002.
Anytime in March, I would like to select data within 01-Feb-2002 to 28-Feb-2002. so forth

I would prefer not to manually input number of days.
Re: How to select previous month's data [message #737 is a reply to message #732] Thu, 28 February 2002 13:30 Go to previous message
Mike
Messages: 417
Registered: September 1998
Senior Member
There are several way to do this one would be:

where date_val >= add_months(trunc(sysdate,'MM'),-1)
and date_val < trunc(sysdate,'MM')
Previous Topic: Re: Returning one boolean for mutiple inputs
Next Topic: Return boolean checking condition in multiple records
Goto Forum:
  


Current Time: Wed Apr 24 18:50:19 CDT 2024