I'm having one of those days (had one yesterday too)
I have a booking system and bookings have a slotStart and slotEnd datetime.
When making a booking I need to check if it overlaps with an existing one. I have all the logic and returns values done, what I can't sort out is the sql.
I have a table with slotstart and slot end, and I pass in the same (Start/ End) I want to return 1 if the new booking overlaps an existing.
I have this but the where isn't right:
Where Location_ID = @Location_ID
And isnull(IsDeleted,0) = 0
(SlotStart < @SlotStart Or SlotStart <= @SlotEnd)