sql query date string minus 30 days code example Example: sql server today minus n SELECT GETDATE() - 1