Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
A T-SQL Challenge
Message
De
15/09/2014 09:50:08
Mike Yearwood
Toronto, Ontario, Canada
 
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Autre
Versions des environnements
SQL Server:
SQL Server 2008
Application:
Web
Divers
Thread ID:
01607327
Message ID:
01607525
Vues:
61
>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.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform