Filter on Previous Third Month

How to create a filter to get only previous third Month Data.

Example: if current Month is May then I should get only the Data of March.

Date Format in Oracle Database: MM/DD/YYYY HH MM SS AM/PM


Mike12 :uk: (BOB member since 2009-12-23)

Hi Mike,

here the month will be entered by user(I mean during run time) or Its just a current month.

Thanks


rak_2010 (BOB member since 2010-05-01)

Look at the following Oracle functions:
sysdate, which returns current date & timestamp
trunc, which allows to truncate a date to the first day of the month for example, or to midnight, etc.
add_months, which subtracts x months from a given date

With some elbow grease of your own you will be able to figure it out.


Andreas :de: (BOB member since 2002-06-20)

I need only Third Last Month, I tried function below specified below but I am getting Last four months of data. I need only Third Month data.

to_char(trunc(@Select(Date \Last Update Date),‘MONTH’)-3,‘MM’)


Mike12 :uk: (BOB member since 2009-12-23)

I take it you’re using > when you should be using = then?