How to query date ranges with SQL
Posted on 2016-11-16
Hello, can some help me understand how to query the below date ranges with MS SQL?
The field is called "myDate" . So if Today's date is 11/16/16.....
I need to get records that were created from midnight of the current day, through right now. (11/16/16 12AM - now)
Next, I need to get records created from midnight of the previous day, to records created at midnight of the current day. (11/15/16 12am - 11/15/16 23:59pm)
Next, I need to get records created between 2 days ago and 14 days ago. (11/2/16 12am - 11/13/16 23:59pm)
I know this is confusing, but can someone assist? Thank you.