Quantcast
Channel: SQLServerCentral » SQL Server 2014 » Development - SQL Server 2014 » Latest topics
Viewing all articles
Browse latest Browse all 3145

Non-aggregating pivot

$
0
0
I'm trying to write a query to turn this record set:eventtype eventdatetimestart 2016-05-17 08:00:00.000start 2016-05-17 09:10:00.000start 2016-05-17 09:40:00.000stop 2016-05-17 08:10:00.000stop 2016-05-17 09:12:00.000stop 2016-05-17 09:50:00.000intostarttime endtime2016-05-17 08:00:00.000 2016-05-17 08:10:00.0002016-05-17 09:10:00.000 2016-05-17 09:12:00.0002016-05-17 09:40:00.000 2016-05-17 09:50:00.000and, of course, keeping them in sequential order.I know there are several ways to accomplish this, but I'm looking for something simple/elegant that can be used in a CTE (i.e.-no ORDER BY clause), if possible.Any thoughts?

Viewing all articles
Browse latest Browse all 3145

Trending Articles