I am trying to create a view that displays events with start and end times. This view should be compiled from an existing table in which there is only an event time field and an event type.
So, the current EventTable looks like this:
EventTime | BooleanField
1/1/2010 6:00AM 1
1/2/2010 6:00AM 0
1/3/2010 6:00AM 1
1/4/2010 6:00AM 1
1/5/2010 6:00AM 0
And the result should look like this:
StartTime | EndTime
1/1/2010 6:00AM 1/2/2010 6:00AM
1/3/2010 6:00AM 1/5/2010 6:00AM
Thus, the view should display the periods in which the logical field is true.
Is there a simple solution for this in SQL Server 2008?
Thank you for your help!
Eskom source
share