Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Same Query, Different Performance with Variables
Message
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Environment versions
SQL Server:
SQL Server 2008
Application:
Web
Miscellaneous
Thread ID:
01509595
Message ID:
01509600
Views:
50
>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
Previous
Reply
Map
View

Click here to load this message in the networking platform