Missing dates in Historical table

General
Enthusiast

Missing dates in Historical table

Hi Team, 

I  have the requirement as below  if the customer doesn’t sold any product for 15 days then it delete the 15 days data in the table. It is working fine if all calendar dates are inserted in the table , but the situation here was last year the records were inserted according to the need.  So if you see the below example records from  7/10 to 7/17 is not getting  deleted as the count is just 8 . But actual count should be 25i.e >15. those need to be deleted

CUSTOMER_ID           DATE         PRODUCT SOLD

1                            6/22/2014          1

1                           6/23/2014         0

1                             7/10/2014        0

1                            7/11/2014         0

1                            7/12/2014         0

1                             7/13/2014        0

1                              7/14/2014       0

1                                 7/15/2014    0

1                                7/16/2014     0

1                             7/17/2014        0

1                           7/18/2014          1