locked
query based on specific hours RRS feed

  • Question

  • User-1260064810 posted

    I have a field in datetime formate like this: 2014/8/29 10:53:00

    I want to list records in August, I have the following:

    select count (*) as howmany from tally where (datepart(mm,  submitTime = '8')

    But I want to further specify the hour within 10 am.  What would the sql be like?

    Thanks.

    Friday, October 24, 2014 5:31 PM

Answers

  • User1508394307 posted

    just add

    AND DATEPART(hh, submitTime)=10

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, October 24, 2014 5:58 PM

All replies

  • User1508394307 posted

    just add

    AND DATEPART(hh, submitTime)=10

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, October 24, 2014 5:58 PM
  • User-1716253493 posted
    WHERE { fn HOUR(submitTime) } = 8

    Friday, October 24, 2014 8:13 PM
  • User-1260064810 posted

    WHERE { fn HOUR(submitTime) } = 8

    Does it mean "give me everything when the hour of submitTime is 8?

    Saturday, October 25, 2014 11:28 AM