Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Fine tuning a SPROC
Message
 
 
À
21/06/2007 21:36:20
John Baird
Coatesville, Pennsylvanie, États-Unis
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Autre
Versions des environnements
SQL Server:
SQL Server 2000
Divers
Thread ID:
01234693
Message ID:
01234906
Vues:
12
>>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=1361636

As 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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform