analog to MySQL's DATE_SUB / INTERVAL

2019-06-16 06:51发布

问题:

In MySQL the following will tell you what the date was a month ago:

SELECT DATE_SUB(NOW(), INTERVAL 1 MONTH);

The SQL fiddle.

How can this be done in SQL Server?

回答1:

try this

SELECT DATEADD(month, -1, GETDATE());