Home » SQL & PL/SQL » SQL & PL/SQL » "Last Month's data" !!! Urgent Please help !!!
"Last Month's data" !!! Urgent Please help !!! [message #739] Thu, 28 February 2002 16:08 Go to next message
Bharat Mehta
Messages: 4
Registered: February 2002
Junior Member
Thanks for some of you guys who replied my request.

I have a time_stamp column (type date)
I would like to get previous whole month's data.

Another word, if I ran query against table
in any time in February 2002. then I would like to get all data from
Jan-1-2002 and Jan-31-2002. Like wise if I ran same query in March 2002, then I would expect all the data
from Feb-1-2002 Feb-28-2002.

Please help
Re: "Last Month's data" !!! Urgent Please help !!! [message #740 is a reply to message #739] Thu, 28 February 2002 17:28 Go to previous message
seng
Messages: 191
Registered: February 2002
Senior Member
To query the month before sysdate, your statement should look like this ..

select * from

where to_char(time_stamp,'mm/yyyy') = to_char(add_months(sysdate ,- 1),'mm/yyyy')
.

Hope this will help you. Thank
Previous Topic: Re: Update ****Return boolean checking condition in multiple records ***
Next Topic: Re: Return boolean checking condition in multiple records
Goto Forum:
  


Current Time: Sat Apr 20 07:33:20 CDT 2024