How to subtract 30 days from the current date using SQL Server

后端 未结 4 1339
梦谈多话
梦谈多话 2020-12-09 01:07

I am unable subtract 30 days from the current date and I am a newbie to SQL Server.

This is the data in my column

date 
----------------------------         


        
4条回答
  •  渐次进展
    2020-12-09 02:04

    SELECT DATEADD(day,-30,date) AS before30d 
    FROM...
    

    But it is strongly recommended to keep date in datetime column, not varchar.

提交回复
热议问题