activity_date Employee_id
5/29/2017 1
4/15/2017 1
1/14/2017 2
4/14/2017 2
2/15/2017 2
6/15/2017 3
1/13/2017 4
How do I write a query that will take a snapshot for latest activity_date by employee as if it were 5/1/2017, then loop again and take a snapshot as if it where 4/1/2017 and so on.
This is the output I want for looping last 3 calendar months.
activity_date Employee_id snapshot_date
4/15/2009 1 5/1/2017
4/14/2009 2 5/1/2017
1/13/2009 4 5/1/2017
2/15/2009 2 4/1/2017
1/13/2009 4 4/1/2017
2/15/2009 2 3/1/2017
1/13/2009 4 3/1/2017
Thank you