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.

 All Forums
 Other Forums
 MS Access
 ?

Author  Topic 

ntn104
Posting Yak Master

175 Posts

Posted - 2008-04-24 : 21:16:10
Anyone can show me the UNION...thanks,

sqlleaf
Starting Member

3 Posts

Posted - 2008-04-25 : 02:36:44
Just something for your consideration. I noticed that your query contains lots of "left join". Usually I'll embed left joins as follows:

select fieldC1, fieldA1, fieldA2, fieldB1, fieldB2
from tbl_c
left join
(
select fieldA1, fieldA2, fieldB1, fieldB2
from tbl_a
left join
(
select fieldB1, fieldB2
from tbl_b
) as b
on a.fieldA1 = b.fieldB1
) as ab
on c.fieldC1 = ab.fieldA1

It helps to start testing from the innermost query, and adding on the outer layers, giving each set of join result a name (e.g. ab) and treating it like a simple table.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-04-28 : 03:10:33
quote:
Originally posted by ntn104

Anyone can show me the UNION...thanks,


Did you change the original question?

Select columns from table1
union
select columns from table2

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -