Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
NickC
Yak Posting Veteran
68 Posts |
Posted - 2010-11-26 : 10:37:17
|
A little bit a of a complex oneWe have to create a report which reports on the refund someone is due when they cancel their policy.Basically if someones policy runs from 01/12/2010 to 31/01/2011, we need to caculate the daily rate over these two months, the problem is the rate changes depending on the number of days in the month so for december it may be 0.2 per day and in january it could be 0.24 per day.Policies can also run longer than two months so it needs to be over x amount of months with each month having a different daily rate.In this example a policy starts on 01/01/2010 and ends on 15/02/2010 however they cancelled on 16/01/2010 so are due a refund of £1.05 so our table in excel looks like this1 1 01/01/2010 31 0.0322580652 1 02/01/2010 31 0.0322580653 1 03/01/2010 31 0.0322580654 1 04/01/2010 31 0.0322580655 1 05/01/2010 31 0.0322580656 1 06/01/2010 31 0.0322580657 1 07/01/2010 31 0.0322580658 1 08/01/2010 31 0.0322580659 1 09/01/2010 31 0.03225806510 1 10/01/2010 31 0.03225806511 1 11/01/2010 31 0.03225806512 1 12/01/2010 31 0.03225806513 1 13/01/2010 31 0.03225806514 1 14/01/2010 31 0.03225806515 1 15/01/2010 31 0.03225806516 1 16/01/2010 31 0.03225806517 1 17/01/2010 31 0.03225806518 1 18/01/2010 31 0.03225806519 1 19/01/2010 31 0.03225806520 1 20/01/2010 31 0.03225806521 1 21/01/2010 31 0.03225806522 1 22/01/2010 31 0.03225806523 1 23/01/2010 31 0.03225806524 1 24/01/2010 31 0.03225806525 1 25/01/2010 31 0.03225806526 1 26/01/2010 31 0.03225806527 1 27/01/2010 31 0.03225806528 1 28/01/2010 31 0.03225806529 1 29/01/2010 31 0.03225806530 1 30/01/2010 31 0.03225806531 1 31/01/2010 31 0.03225806532 2 01/02/2010 28 0.03571428633 2 02/02/2010 28 0.03571428634 2 03/02/2010 28 0.03571428635 2 04/02/2010 28 0.03571428636 2 05/02/2010 28 0.03571428637 2 06/02/2010 28 0.03571428638 2 07/02/2010 28 0.03571428639 2 08/02/2010 28 0.03571428640 2 09/02/2010 28 0.03571428641 2 10/02/2010 28 0.03571428642 2 11/02/2010 28 0.03571428643 2 12/02/2010 28 0.03571428644 2 13/02/2010 28 0.03571428645 2 14/02/2010 28 0.03571428646 2 15/02/2010 28 0.035714286 |
|
Sachin.Nand
2937 Posts |
Posted - 2010-11-26 : 13:50:48
|
So do you have a table which stores rates for a particular month?PBUH |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-11-27 : 02:12:39
|
i see only one date field in table. is this policy date or cancelled date?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|