Assume we have a table in MSSQL Server with a column holding a time of last update.
We want to remove all records whose last update time is older than one day.
DATEADD(Day, DATEDIFF(Day, 0, GetDate())-1, 0)
DELETE FROM [tablename] WHERE [dateTimeField] < DATEADD(Day, DATEDIFF(Day, 0, GetDate())-1, 0)
Tags
SQL Server