Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
maevr
Posting Yak Master
169 Posts |
Posted - 2012-10-16 : 10:02:47
|
I need to write a query that selects records from multiple tables including a subquery but I belive I do something wrong since the select takes "forever" to run and the tempdb fills up quickly.Smaller example:selecta.id,a.col2,fa.col3,fa.col4,e.col5,e.col6,f.col7from tbl1 a inner join(select a1.id, b1.col2, c1.col3 from subTbl1 a1 inner join subTbl2 b1 on a1.id = b1.id inner join subTbl3 c1 on b1.id = c1.idwhere a1.val = 'Yes') as faon a.id = fa.id inner join tbl2 e on a.id = e.idinner join tbl3 f on a.id = f.id |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-10-16 : 23:13:03
|
did you check the execution plan? what are the indexes table have?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
|
|
|