I have a column which contain dates of transactions occurred on working days. I am trying to group my customers to see their end of month totals for the last number of months.
Essentially, how do I get the max date for each of the last 6 months in SQL?
Example table below
ID | Date |
---|---|
610 | 11/30/2021 |
610 | 11/29/2021 |
610 | 11/28/2021 |
610 | 10/29/2021 |
610 | 10/15/2021 |
610 | 9/15/2021 |
610 | 9/14/2021 |
610 | 8/10/2021 |
725 | 11/30/2021 |
725 | 11/29/2021 |
725 | 11/28/2021 |
725 | 10/29/2021 |
725 | 10/15/2021 |
725 | 9/15/2021 |
725 | 9/14/2021 |
725 | 8/10/2021 |
what I would like to return is the table below
ID | Date |
---|---|
610 | 11/30/2021 |
610 | 10/15/2021 |
610 | 9/15/2021 |
610 | 8/10/2021 |
725 | 11/30/2021 |
725 | 10/29/2021 |
725 | 9/15/2021 |
725 | 8/10/2021 |