a guest Oct 12th, 2018 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. cross apply (SELECT
  2.       sum(case when [day] between @FirstDay and @LastDay then 1 else 0 end) as UsedDays
  3.                  FROM Calendar c
  4.         WHERE ([day] >=  r.[DateFrom]   AND [day] <= r.[DateTo] AND [WorkDay] = 1))calculateUsedDays
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand