neubert
neubert

Reputation: 16792

analog to MySQL's DATE_SUB / INTERVAL

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?

Upvotes: 12

Views: 13193

Answers (1)

polybios
polybios

Reputation: 1159

try this

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

Upvotes: 20

Related Questions