Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
An update which does not finish
Message
De
20/04/2015 14:44:56
 
 
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Autre
Versions des environnements
SQL Server:
SQL Server 2012
Application:
Web
Divers
Thread ID:
01618796
Message ID:
01618811
Vues:
35
>How long does this query take?
>
>
>SELECT Client.ClientNo,  DATEDIFF(SECOND,
>   CASE WHEN BT.Start>Client.FirstDate THEN BT.Start ELSE Client.FirstDate END,
>   CASE WHEN BT.[End]<Client.SecondDate THEN BT.[End] ELSE Client.SecondDate END) AS SecondValue
>   FROM BusinessTime BT INNER JOIN Client ON
>   
>    BT.Start<Client.SecondDate AND BT.[End]>=Client.FirstDate
>   WHERE BT.NoProvince=84 AND BT.NoHoliday=0
>
>See this Wiki Page for simplification of your ranges

I am still not sure about the usage of that select. The initial example were using static values and that worked. Then, after, there was a need to evolve that approach to have those values to be bounced on the table first and last dates. If there is only one select here, with reference to the main table, how would that work?

Thanks for the range simplication, I have adjusted.
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