Last post Oct 25, 2014 11:28 AM by comego
Member
65 Points
204 Posts
Oct 24, 2014 05:31 PM|comego|LINK
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.
All-Star
35149 Points
9075 Posts
Oct 24, 2014 05:58 PM|smirnov|LINK
just add
AND DATEPART(hh, submitTime)=10
52813 Points
15769 Posts
Oct 24, 2014 08:13 PM|oned_gk|LINK
WHERE { fn HOUR(submitTime) } = 8
Oct 25, 2014 11:28 AM|comego|LINK
oned_gk WHERE { fn HOUR(submitTime) } = 8
Member
65 Points
204 Posts
query based on specific hours
Oct 24, 2014 05:31 PM|comego|LINK
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.
All-Star
35149 Points
9075 Posts
Re: query based on specific hours
Oct 24, 2014 05:58 PM|smirnov|LINK
just add
AND DATEPART(hh, submitTime)=10
All-Star
52813 Points
15769 Posts
Re: query based on specific hours
Oct 24, 2014 08:13 PM|oned_gk|LINK
Suwandi - Non Graduate Programmer
Member
65 Points
204 Posts
Re: query based on specific hours
Oct 25, 2014 11:28 AM|comego|LINK