Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
A T-SQL Challenge
Message
From
15/09/2014 09:50:08
Mike Yearwood
Toronto, Ontario, Canada
 
General information
Forum:
Microsoft SQL Server
Category:
Other
Environment versions
SQL Server:
SQL Server 2008
Application:
Web
Miscellaneous
Thread ID:
01607327
Message ID:
01607525
Views:
60
>An alternative solution to cross apply
>
>
>
>select a.name
>		,a.phase as fromphase 
>		,b.phase as tophase
>		,a.starttime 
>		,b.endtime 
>		,DATEDIFF( S,a.starttime,b.endtime) as elapsed
>	from timephases a
>	inner join timephases b
>	on a.name = b.name and a.phase<=b.phase 
>	order by a.name,fromphase,tophase 
>
>
Very nice - I'd suggest you avoid arbitrarily assigning a, b, c. t1 and t2 would be a little more appropriate than a, b.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform