I'm using SQL Server 2012.
i have a table Event
ID StartTime EndTime 1 2018/06/30 09:03:00 2018/06/30 09:37:00 2 2018/06/30 09:43:00 2018/06/30 09:55:00
I have a temp table - which has time split into 15mins interval for last 24 hours from current time
ID Istart Iend 1 09:00 09:15 2 09:15 09:30 3 09:30 09:45 4 09:45 10:00
My output should be - compare the event table (if whole range covered then 1)
ID Istart Iend active 1 09:00 09:15 1 2 09:15 09:30 1 3 09:30 09:45 0.25 4 09:45 10:00 0.75
Please help me to generate SQl query for the above output