Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Using CASE WHEN in JOIN?
Message
 
 
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Autre
Versions des environnements
SQL Server:
SQL Server 2008
Divers
Thread ID:
01535407
Message ID:
01535410
Vues:
71
This message has been marked as the solution to the initial question of the thread.
The CASE is a function. The way you used it doesn't make any sense.
Try
ON (Table1.Fld1='' AND Table1.Fld2 = Table2.Fld2 )
   OR 
   (Table1.Fld1<>'' AND Table1.Fld1 = Table2.Fld1)
>
>I am trying to "translate" the VFP code that has IIF() in the JOIN into SQL Server systax. Here is what I have (but gives me error):
>
>
>select * from Table1 left join Table2 ON CASE WHEN LEN(RTRIM(Table1.Fld1))=0 THEN Table1.Fld2 = Table2.Fld2 
>  ELSE Table1.Fld1 = Table2.Fld1 END
>
>
>What am I missing? TIA
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform