I was given a database of records with their name, phone number, date of their last purchase and the amount of the purchase. There are many duplicates.
I need to isolate those records that are 0-2 years from last purchase and 2+ yrs from last purchase. If the phone number appears in duplicate for both time frames, we want to mark for deletion those that are 2+ years old since technically they are more recent purchases made.
Once that is done, I need to determine if the record appears more than once for the time frame, that I mark only the highest purchase amount, as the file will be reduced in size to only those who spent over X number of dollars.
So, for example,
John Smith 222-545-5555 07/28/13 $125
John Smith 222-545-5555 04/17/15 $600
John Smith 222-545-5555 06/30/15 $125
John Smith 222-545-5555 07/22/15 $85
John smith bought 3 times in 2015 and once in 2013. I want to mark his record from 2013 for deletion (without actually deleting it) because he's not a 'old' client, he's bought more recently.
Then of the 3 entries in 2015, I want to either mark for deletion the lower 2 amounts or mark the highest amount. Whichever is easier. That way the only record that I'll have left at the end is John Smith 222-545-5555 04/17/15 $600 because that is the most he spent, so if the client asks me to delete all records below $500, John smith will still be in the list.
Bookmarks