Check if a time is between two times (time DataType)

前端 未结 7 1390
我寻月下人不归
我寻月下人不归 2020-12-06 10:05

I have a table that has a column \"Created\" as a datetime.

I\'m trying to query to check if the time for the Created value is between two times.

The Created

相关标签:
7条回答
  • 2020-12-06 10:31

    Should be AND instead of OR

    select *
    from MyTable
    where CAST(Created as time) >= '23:00:00' 
       AND CAST(Created as time) < '07:00:00'
    
    0 讨论(0)
提交回复
热议问题