>>Nope, it is still correct. Every left join is equal to inner join + union for the rest. You can use NOT EXISTS and the same query as at the top or use CTE in SQL Server 2005. There was an interesting discussion in tek-tips forum on a similar problem, but I'm not going to search for it right now.
>
>I asked for an example; you posted one that did not prove your assertion. Like to try again?
I found tek-tips discussion in the meantime, which turned out to be completely unrelevant, but anyway
http://tek-tips.com/viewthread.cfm?qid=1361636As for the select with union, from the top of my head (not-tested):
select * from Table1 inner join Table2 on condition
union
select Table1.*, cast to create fields from table2
where not exists (select * from Table1 inner join Table2 on condition)
AFAIK, tt is the same as
select * from Table1 left join Table2 on condition
In other words, every left join can be re-written as inner join + union. Same goes for the right join and for the FULL join we need two unions. That's just a simple fact, same as that every recursive algorithm can be re-written without recursion.
If it's not broken, fix it until it is.
My Blog