Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Adding a CASE WHEN in a WHERE clause
Message
De
30/07/2015 09:07:29
 
 
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:
01622686
Vues:
29
>Start from this query:
>
>
>;with cte as (select Client.*, COALESCE(Company.NoProvince, 84) as NoProvince 
>from Client LEFT JOIN Company ON Client.NoCompany = Company.Numero and Company.NoCountry = 1
>WHERE Client.FirstAcceptDate>'1899-12-30 00:00:00.000' AND
>    Client.QueryDate>'1899-12-30 00:00:00.000' AND
>    Client.QueryDate>=Client.FirstAcceptDate AND
>    Client.NoCompany>0
>UNION ALL
>select Client.*, COALESCE(Research.NoProvince, 84) as NoProvince 
>from Client LEFT JOIN Research ON Client.NoReseach = Research.Numero and Research.NoCountry = 1
>WHERE Client.FirstAcceptDate>'1899-12-30 00:00:00.000' AND
>    Client.QueryDate>'1899-12-30 00:00:00.000' AND
>    Client.QueryDate>=Client.FirstAcceptDate AND
>    Client.NoResearch>0)
>
>select * from cte
>
>This is what you're going to join with the sum of the BusinessTime.

Thanks
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
Répondre
Fil
Voir

Click here to load this message in the networking platform