Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL join
Message
 
 
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Titre:
Versions des environnements
SQL Server:
SQL Server 2005
Application:
Desktop
Divers
Thread ID:
01380251
Message ID:
01380829
Vues:
34
I posted a FULL JOIN version in my original reply.

>>I stand to be corrected. What I mean is the Region Code -- REG003 did not show up in the resultset.
>>
>>However, I came up with this solution. Not sure if there is better way of doing this.
><snip>
>
>You can use FULL JOIN in combination with ISNULL()
>
>SELECT 
>		ISNULL(t1.RegionCode, t2.RegionCode) AS  RegionCode,
>		ISNULL(t1.DepotCode, t2.DepotCode) AS DepotCode,		
>		ISNULL(t1.DistrictCode, t2.DistrictCode) AS DistrictCode,
>		t1.SaleType, t1.TargetSales, t1.ActualSales, t1.IsAchieved, t2.ValueType
>	FROM table1 t1 
>		FULL JOIN table2 t2 
>   			ON t2.RegionCode = t1.RegionCode 
>				AND t2.DepotCode = t1.DepotCode 
>				AND t2.DistrictCode = t1.DistrictCode
>
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform