I need to select from a table that has two fields , a start date and an end date , selecting the row that the current date is. Look at the image ...how do i select the row that encompasses the date range 91/201 - 9/15/2018 ? Somehow this was flagged as a duplicate. I am NOT attempting to find overlap. I am attempting to find the row that represents a given date. Say , one table has a field that has the value 9/5/2018 ....how do I select the row that has a start date of 9/1/2018 and end date of 9/15/2018
Asked
Active
Viewed 33 times
0
-
I marked this duplicate, because a 30 second search on Stack Overflow would have turned up several queries which could immediately solve your problem. Had you posted a query attempt, I would not have marked duplicate. – Tim Biegeleisen Sep 24 '18 at 14:37
-
The returned searches showed a completely different thing that I was trying to accomplish, date overlap is easy ,in fact I intend to respond to what was listed with a simpler solution – Anthony Parker Sep 24 '18 at 14:54
-
1`WHERE '2018-09-05' BETWEEN start AND end` <-- is this what you want? – Tim Biegeleisen Sep 24 '18 at 14:57
-
It literally sounds like you just need a `WHERE MyDateColumn BETWEEN '2018-09-01' AND '2018-09-15'`. If you have more than the one row in between those date ranges that is the only time that will come back with more than one record. – arahman Sep 24 '18 at 15:29
-
WHERE getdate() BETWEEN start AND end is what I will try for some reason I wasn't sure between accepted a field as an argument – Anthony Parker Sep 24 '18 at 15:46