Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Using CASE in JOIN expression
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Versions des environnements
SQL Server:
SQL Server 2005
Divers
Thread ID:
01411536
Message ID:
01501560
Vues:
44
>
>.... ON TABLE1.ID_FLD = CASE WHEN TABLE2.ORDER_NO > 0
>                                  THEN TABLE2.ID_FLD
>                             ELSE TABLE3.ID_FLD END
>...
>
Hi Boris,

I'm trying to figure out something similar. I want to JOIN either with Table2 or with Table1 depending on a certain field in Table1.

Say, if Table1.Type = 'R' then I want to join and get fields from Table2 and if Table1.Type = 'S' I want to join with Table3

I can not figure out if this is possible at all.

UPDATE. It's impossible.
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