sipwiz sipwiz - 2 years ago 122
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)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download