Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Simplifying WHERE clause with CASE WHEN
Message
From
21/04/2015 17:58:26
 
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Environment versions
SQL Server:
SQL Server 2012
Application:
Web
Miscellaneous
Thread ID:
01618887
Message ID:
01618916
Views:
38
>Well, to me the re-factored command is much easier to understand and debug. But it's up to you to take the suggestion and try it or not.

This would be better:
...
     WHERE BusinessTime.NoProvince=
      (SELECT COALESCE((SELECT Company.NoProvince FROM Company WHERE Company.NoCountry=1 AND Company.Numero=Client.NoCompany),84)) AND
      BusinessTime.NoHoliday=0 AND
      BusinessTime.Start<Client.FirstDate AND
      BusinessTime.[End]>=Client.SecondDate) Temp)
...
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform