Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Same Query, Different Performance with Variables
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Versions des environnements
SQL Server:
SQL Server 2008
Application:
Web
Divers
Thread ID:
01509595
Message ID:
01509600
Vues:
51
>Try
>
>SELECT maintable.pk,
>		(select COUNT(*) from childtable1 where pk = maintable.pk) as a,
>		(select COUNT(*) from childtable2 where pk = maintable.pk) as b,
>		(select COUNT(*) from childtable3 where pk = maintable.pk) as c,
>		(select COUNT(*) from childtable4 where pk = maintable.pk) as d,
>		(select COUNT(*) from childtable5 where pk = maintable.pk) as e,
>		(select COUNT(*) from childtable6 where pk = maintable.pk) as f
>	from maintable
>	where maintable.pk = @lnPK
>
Thanks Sergey. This query is so much better and simpler than the tangled mess I was writing.
Brandon Harker
Sebae Data Solutions
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform