I need an sql to find overlapping date ranges for events in the same room -
i need write sql find overlapping date ranges take place in same room. example, have fields room_num, start_time, , stop_time. each record represents session taking place in room_num. need find if sessions have same room number overlap each other.
you can try this. please note - haven't tested it!
select e1.room_num, e1.start_time, e1.stop_time e2.start_time, e2.stop_time events e1, events e2 (e1.start_time between e2.start_time , e2.end_time or e1.end_time between e2.start_time , e2.end_time) , e1.room_num = e2.room_num
if between doesn't work (could oracle specific), rewrite 2 separate >= , <= conditions.
Comments
Post a Comment