Hi,
I have a loop in which I would like to Select query on weekly basis starting from the last date, essentially traversing backwards week-by-week. For example the table below represents the sample data for the query within loop, without WHERE clause. What I like to get from the first iteration, say 5 years length backwards from the last date, which is 16/05/2014. In the second iteration the last date would be 08/05/2014, because that is the next backward week date and again for 5 years period from that date.
II am not proficient with SQL especially when it comes to dates and I am looking for the neat approach as I have thousands of iterations and performance is the important factor here.
Thanks