I am having an Event Management System in which i want,
If an event is registered for 5 days (21 jan 2009 to 26 Jan 2009) Then if another person wants to register an event between 22 jan 2009 to 24 jan 2009 then it will not allow to register. I want to check this using SQL query, so please tell me how can i do this.
SELECT *
FROM events e
WHERE (@startDate BETWEEN e.startDate and e.endDate)
OR (@endDate BETWEEN e.startDate and e.endDate)
OR (@startDate < e.startDate AND @endDate > e.endDate)