I have a select SQL statement as bellows:
SELECT sta_date FROM dbm031fa WHERE year(sta_date) = year(CURRENT_TIMESTAMP)-2If I would like to get the value of sta_date is the value in database subtract one year, how to do it?
Microsoft SQL Server had a build-in function, DATEADD, to fulfill this requirements.
The SQL statement can be modified as following:
SELECT sta_date, DATEADD(YEAR, -1, sta_date) FROM dbm031fa WHERE year(sta_date) = year(CURRENT_TIMESTAMP)-2