December 30, 2013 at 11:54 am
Happy holidays!
Ok, I have a question that seems basic, but I am having major issues. I need to compare the following date/times. Basically I need to select from a table where the date range is between '12/15/2013' and '12/21/2013' and time is BETWEEN 5:00PM and 8:00AM. I cannot seem to get this working.
Here is what I have... INTERVALSTART is in the following format (datetime): '2013-12-15 18:30:00.000'.
Any help is greatly appreciated.
SELECTsum(abncalls), INTERVALSTART
FROMoadb.hCMSSkill
WHERE INTERVALSTART >= '12/15/2013 17:00:00.000' AND INTERVALSTART <= '12/21/2013 08:00:00.000'
December 30, 2013 at 12:03 pm
It would be helpful if you told us what issues you're experiencing.
For best practices on asking questions, please read the following article: Forum Etiquette: How to post data/code on a forum to get the best help[/url]
December 30, 2013 at 12:06 pm
Thanks for your response.
My issue is that I am not able to get the correct values. The date range values are fine, but the times are off. I shouldn't see any time between work hours (8:00AM - 5:00PM), but I am still seeing those times.
I hope this explains my issue.
December 30, 2013 at 12:18 pm
Your problem is that you have not restricted the times as you wanted to.
You're asking for values between 12/15/2013 17:00:00 and 12/21/2013 08:00:00 not between 12/15/2013 and 12/21/2013 only where the time is between 5:00PM and 8:00AM.
You need to add another condition to the where clause that only looks at the time portion of the date and restrict that to only times between 5:00PM and 8:00AM.
For best practices on asking questions, please read the following article: Forum Etiquette: How to post data/code on a forum to get the best help[/url]
December 30, 2013 at 12:19 pm
Thanks Alvin. I will try that. Happy New Year to you and thanks for your time
December 30, 2013 at 12:21 pm
You're welcome and Happy New Year to you too.
Let us know if you have any more issues.
For best practices on asking questions, please read the following article: Forum Etiquette: How to post data/code on a forum to get the best help[/url]
Viewing 6 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy