Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
An update which does not finish
Message
From
20/04/2015 14:44:56
 
General information
Forum:
Microsoft SQL Server
Category:
Other
Environment versions
SQL Server:
SQL Server 2012
Application:
Web
Miscellaneous
Thread ID:
01618796
Message ID:
01618811
Views:
37
>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform