sipwiz sipwiz - 1 year ago 83
SQL Question

SQL Server select where datetimeoffset older than 1 hour

I know this should be easy and I do it no probelms in mySQL and Postgresql but I'm struggling with SQL Server. I want to select rows with a datetimeoffset field that's over an hour old.

select * from table where mydatetime < getdate() - 1 hour

I've tried dateadd and datediff but can't get it right.

Answer Source

For more see: DATEADD (Transact-SQL)