0

Hey guys

I have a current query that looks something like:

select a.avalue, b.bvalue, c.cvalue from

(select idVal, dummyVal as avalue from....) as a

left join

(select idVal, dummyVal as bvalue from....) as b

on a.idVal = b.idVal

left join

(select idVal, dummyVal as cvalue from....) as c

on b.idVal = c.idVal

Now, in each of those nested select statements, I need to put another nested select, so i have something like:

select a.avalue, b.bvalue, c.cvalue from

(select idVal, dummyVal as avalue from (select ...)) as a

left join

(select idVal, dummyVal as bvalue from (select ...)) as b

on a.idVal = b.idVal

left join

(select idVal, dummyVal as cvalue from (select ...)) as c

on b.idVal = c.idVal

Now, because my actual query is a lot bigger and complex than the one above, it will take a long time to execute. So i was wondering if i were to create the new nested select statement from the second code example separately, and then left join the 3 queries to it, would it run any faster? I haven't tried yet as my query is very bug and want to ask aroundhere for opinions first. I'm thinking something like

select a.avalue, b.bvalue, c.cvalue from

//new nested query

(select idVal as nestedvalue from ...) as nested

left join 

(select idVal, dummyVal as avalue from ...) as a

on a.idVal = nested.idVal

left join

(select idVal, dummyVal as bvalue from ...) as b

on b.idVal = nested.idVal

left join

(select idVal, dummyVal as cvalue from ...) as c

on c.idVal = nested.idVal

Any help is greatly appreciated!

2
Contributors
2
Replies
3
Views
9 Years
Discussion Span
Last Post by 2eXtreme
0

um i dont know what that means, but i dont need to do that anymore, but thanks for you help!

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.