Find records produced in the last hour

后端 未结 4 2100
忘了有多久
忘了有多久 2021-02-20 00:59

I have a smalldatetime field named myTime recording when the record was created. I need the syntax that selects records created within the last hour.

4条回答
  •  一生所求
    2021-02-20 01:33

    Use this:

    SELECT * FROM YourTable WHERE YourDateTime >= DATEADD(hh, -1, GETDATE())
    

提交回复
热议问题