Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Adding a CASE WHEN in a WHERE clause
Message
De
29/07/2015 16:24:27
 
 
À
29/07/2015 16:21:59
Walter Meester
HoogkarspelPays-Bas
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Versions des environnements
SQL Server:
SQL Server 2012
Application:
Web
Divers
Thread ID:
01622652
Message ID:
01622659
Vues:
34
>I would rewrite it into a form like
>
>
>UPDATE Client
>	SET DayBetweenFirstAcceptSoldDate = CASE WHEN ....WHEN ... WHEN ... THEN ... ELSE 0 END
>	FROM Client
>		LEFT JOIN BusinessTime ON ....
>		LEFT JOIN Company ON ....
>		LEFT JOIN Research ON ....
>
>
>This will give the optimizer a chance to get you the best performance possible.

Yes, I had that at first but this creates a too long command as I need to repeat pretty much the entire base command. By putting the CASE WHEN inside the WHERE clause, this allows to keep the core of the command as is but only to add an exception down below.
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform