Skip to content
Advertisement

Calculate SUM between two dates SQL SERVER

I’m having two tables

Calendar

ProfileRate

I want to calculate SUM. Something like this

What I’ve tried:

Please help me. Thanks

Advertisement

Answer

you have to do several steps to solve the problem:

  1. combine calendar records with profiles
  2. establish which profiles meet the calendar range
  3. total the value for each profile and date range
  4. finally establish the detailed information of the calendar

this query meets the conditions

in this example you can find step by step how it work

in this example there is one more product and one more calendar.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement