I have a table and one of the fields is a date field.
I have been asked to write a query that returns a list of distinct dates (ordered) in say column A and then have another column, say B of dates where the date in column B is the greatest date that is less than column A.
MyDateField
2017-01-01
2017-01-01
2017-01-01
2017-01-02
2017-01-02
2017-01-03
2017-01-04
2017-01-05
2017-01-05
2017-01-05
Answer required
2017-01-05 2017-01-04
2017-01-04 2017-01-03
2017-01-03 2017-01-02
2017-01-02 2017-01-01
2017-01-01