Hi,
I am new in SQL developing and have a question to find overlapping schedule based on Startdate/EventStatus/FunctionRoom/StartTime and End Time.
<style type="text/css"><!--td {border: 1px solid #ccc;}br {mso-data-placement:same-cell;}--></style>
| S.No | EventStatus | StartDate | StartTime | EndTime | FunctionRoom | Flag |
| 1 | Accepted | 2019-06-05 | 4:30 AM | 9:00 PM | Ball Room | |
| 2 | Accepted | 2019-06-05 | 5:30 AM | 8:00 PM | Ball Room | |
| 3 | Tentative | 2019-06-06 | 10:00 AM | 5:00 PM | Ball Room1 | |
| 4 | Accepted | 2019-06-07 | 3:00 PM | 7:00 PM | Ball Room2 | |
| 5 | Accepted | 2019-06-08 | 12:00 PM | 5:00 PM | Ball Room 3 | |
| 6 | Tentative | 2019-06-08 | 12:00 AM | 6:00 AM | Ball Room 4 |
Need to fill Flag column Y if any overlap schedule find other wise N
Hope i will get SQL statment here and i tried below statement and it's gave different result
update a set Flag ='Y' from [Employee].[dbo].[EventTable]as a Inner Join [Employee].[dbo].[EventTable_Insert] as bOn a.StartDate = b.Startdate and a.FunctionRoom =b.FunctionRoom and a.EventStatus = b.EventStatus
where ((a.StartTime between b.StartTime and b.EndTime) and (a.EndTime between b.StartTime and b.EndTime) and (b.StartTime between a.StartTime and a.EndTime))
Thanks
Venkat
Regards Venkat