Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Simplifying WHERE clause with CASE WHEN
Message
 
 
To
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:
01618917
Views:
35
>>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)
>...
>
This would not work. You're not getting NULL, you're not getting result at all.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform