In the school different staff come at different time.
NAME | Date | INTIME | OUTIME
A | 2015-10-08 | 08:00:00 | 18:00:00
B | 2015-10-08 | 10:00:00 | 14:00:00
C | 2015-10-08 | 15:00:00 | 18:00:00
We want output like this
Date | Time Range | People Present
2015-10-08 | 08-09 | 1
2015-10-08 | 09-10 | 1
2015-10-08 | 10-11 | 2
2015-10-08 | 11-12 | 2
2015-10-08 | 12-13 | 2
2015-10-08 | 13-14 | 2
2015-10-08 | 14-15 | 3
How can we generate such an output through query.