Sunday, March 1, 2015

Spreading Amount across financial year based on Start and End Date


DECLARE @table TABLE ( PropCode INT
,PropStartDate DATE
,PropEndDate char(10)
,PropRentStartDate DATE
,PropRentEndDate DATE
,MarketRent INT)

INSERT INTO @table (PropCode,PropStartDate, PropEndDate,PropRentStartDate,PropRentEndDate, MarketRent) VALUES

(2718, '2013-01-30', 'NULL', '2012-11-29', '2013-07-21', 289.20)
,(2718, '2013-01-30', 'NULL', '2013-07-22', '2013-11-24', 289.20)
,(2718, '2013-01-30', 'NULL', '2013-11-25', '2014-06-14', 289.20)
,(2718, '2013-01-30', 'NULL', '2014-06-15', '2014-11-30', 299.18)
,(2718, '2013-01-30', 'NULL', '2014-12-01', '2015-01-02', 299.18)
,(2718, '2013-01-30', 'NULL', '2015-01-03', '2050-01-01', 310.00)
,(3901, '2014-05-27', 'NULL', '2014-06-09', '2014-11-30', 400.00)
,(3901, '2014-05-27', 'NULL', '2014-12-01', '2050-01-01', 400.00)
,(3960, '2014-10-31', 'NULL', '2014-11-05', '2016-11-05', 470.00)

Select * from @table



Hi Patrick,


Please find attached the table


Thanks


No comments:

Post a Comment