How do you get the 30 days before today in SQL.
This question is related to
sql
sql-server
datetime
In MS SQL Server, it is:
SELECT getdate() - 30;
Try adding this to your where
clause:
dateadd(day, -30, getdate())
SELECT (column name) FROM (table name) WHERE (column name) < DATEADD(Day,-30,GETDATE());
Example.
SELECT `name`, `phone`, `product` FROM `tbmMember` WHERE `dateofServicw` < (Day,-30,GETDATE());
Source: Stackoverflow.com