Skip to content
Advertisement

How do I find data from this day exactly one year ago in oracle?

Merry Christmas,

I am using the below query to get the prices, but my requirement is to get the data for last one year from trunc(sysdate). i have tried using DATEADD function but its gives me an error

cast(p.asof as DATE) = cast(DATEADD(Year, -1, GETDATE()) as DATE)

Can anyone please help, what all changes i require to get the desired result ?

Advertisement

Answer

use add_months and sysdate:

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement