Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using CASE in JOIN expression
Message
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Environment versions
SQL Server:
SQL Server 2005
Miscellaneous
Thread ID:
01411536
Message ID:
01501560
Views:
43
>
>.... 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
Previous
Reply
Map
View

Click here to load this message in the networking platform